-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from NAG-DevOps/adding_matlab_script
Adding matlab-example
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
% Turn on the diary to start logging output to a file | ||
diary('console_output.txt') | ||
|
||
% Define the size of the matrices | ||
n = 4; | ||
|
||
% Generate two random matrices A and B of size n x n | ||
A = rand(n); | ||
B = rand(n); | ||
|
||
% Multiply the two matrices | ||
C = A * B; | ||
|
||
% Compute the eigenvalues of the resulting matrix C | ||
eigenvalues = eig(C); | ||
|
||
% Optionally, print the matrices and the eigenvalues to the MATLAB console | ||
disp('Matrix A:'); | ||
disp(A); | ||
disp('Matrix B:'); | ||
disp(B); | ||
disp('Product Matrix C:'); | ||
disp(C); | ||
disp('Eigenvalues of Matrix C:'); | ||
disp(eigenvalues); | ||
|
||
% Turn off the diary to stop logging | ||
diary off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters