basic operations, could someone help me do this?

Create two random matrices in Matlab, A (n x m) and B (m x n). a) Find the product ? = ? ∙ ?; b) Create a symmetric matrix D using C; c) Find the eigenvalues and eigenvectors of matrix D; d) Sort the eigenvalues and the eigenvectors according ascending/descending order of eigenvalues; e) Sort the eigenvalues and the eigenvectors according to a random order; f) Plot the eigenvalues and the accumulative eigenvalues; g) Plot the dot product matrix of eigenvectors as a 2D surface.

댓글 수: 2

darova
darova 2019년 11월 11일
What have you tried?
Gentrit Mehmeti
Gentrit Mehmeti 2019년 11월 11일
편집: Gentrit Mehmeti 2019년 11월 11일
this, i got this as a school project for tomorrow midterm exam and I did this with the help of previous answer, if this what i've done is okay only the sort in random order and the plots are left, I would appreciate any help given
% creating two random matrices A and B.
A = rand(4,4);
B = rand(4,4);
% a) The product of two matrices A and B
C = A*B;
% b) Symmetric matrix D using C
D = C+C';
% c) Eigenvalues and eigenvectors of matrix D
[V,E] = eig(D);
% d) Sorting the eigenvalues and eigenvectors according ascend/descending
% order of eigenvalues
%there are multiple ways doing this, one of them is this:
% ascending order Eigenvalues
E_ascend = sort(E, 1, 'ascend');
E_ascend_result = sort(E_ascend, 2, 'ascend');
%descending order Eigenvalues
E_descend = sort(E, 1, 'descend');
E_descend_result = sort(E_descend, 2, 'descend');
%ascending order of eigenvectors
V_ascend = sort(V, 1, 'ascend');
V_ascend_result = sort(V_ascend, 2, 'ascend')
%descending order or eigenvectors

댓글을 달려면 로그인하십시오.

 채택된 답변

aweller3
aweller3 2019년 11월 11일

0 개 추천

This is a partial answer. To create a random mXn matrix you can use A=rand(m,n) with m rows and n columns, with random values between 0 and 1. For some purposes I think rand might not be truly random but this is way beyond my level. If you need integers randi(m,n) should work. For the product just type C=A*B
For the eigenvalues and eigen vectors lookup the eig function here: https://www.mathworks.com/help/matlab/ref/eig.html
[V,L]=eig(D) will give eigenvectors of D stored in V and eigenvalues stored in L once you find the matrix D.
Information on plot can be found here:

추가 답변 (1개)

카테고리

도움말 센터File Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

질문:

2019년 11월 11일

편집:

2019년 11월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by