plotting eigen vectors (nomal modes ) of a 9x9 matrix
2 views (last 30 days)
Show older comments
I have a matlab code for solving eigenvalues and eigenvectors problems but the ways is that i can normally plot differents eigenvalues of my matrix which depend on the varible x=-1:1. My problem is that I don't know how to plot in 3D the corresponding eigenvectors ( ie xlabel: x=-1:1, ylabel: y=-1:1 and Zlabel: z=eigenvectors )
This the correpondint code :
close all;clear all; U =0.9; f= 39; nx=f;T=1;
x=-3.086476993000499:3.096476993000599; y=x;
A=zeros(nx,nx); B=zeros(nx,nx); mat=zeros(nx,nx);
for kappa=1:numel(x) % nu=1:f-1
Rep = T.*(2.0.*cos(x(kappa)/2.0).*cos(x(kappa).*f/2.0)); Imp = 0.0;
Req = T.*(1.0 + cos(x(kappa))); Imq = T.*(sin(x(kappa)));
A(1,1)=U ; A(1,2)=sqrt(2.0)*Req; A(2,1)=sqrt(2.0)*Req;
B(1,2)=sqrt(2.0)*Imq; B(2,1)=-sqrt(2.0)*Imq;
for i=2:nx-1
A(i,i+1)=Req; A(i+1,i)=Req ;B(i,i+1)=Imq; B(i+1,i)=-Imq;
end
A(nx,nx)=Rep ; B(nx,nx)=Imp;
for i=nx:-1:1
for j=nx:-1:1
mat(i,j)=A(i,j);
mat(i,j+nx)=B(i,j);
mat(i+nx,j)=-B(i,j);
mat(i+nx,j+nx)=A(i,j);
end
end
[v,d0] = eig(mat); % eigenvectors and eigenvalues
%vv=v(:,kappa) ; v0=vv/norm(vv); C0=v0.*v0 % give us \c0\^2
dd=d(:,kappa); d0=dd/norm(dd); z=d0*d0' ; surf(z);
%d0(kappa,:)=eig(mat); for eigenvalue only
end
% plot(d0,'r-');
0 Comments
Answers (1)
johnson wul
on 15 Aug 2019
hi kone. in your problem just use d=eig() to find your eigenvalues.
0 Comments
See Also
Categories
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!