Plotting eigenvalues of a 4*4 matrix: In an assignment A(I) = B, the number of elements in B and I must be the same.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
p=1;
for k=0.1:.1:3
A=[0 0 0 exp(-i*k);exp(i*k) 0 0 0;0 exp(i*k) 0 0;0 0 exp(i*k) 0];
C=eig(A);
x(p)=k;
y(p)=C;
p=p+1;
end
plot(x,y)
0 commentaires
Réponses (1)
Bhanu Prakash
le 16 Avr 2023
Hi Zahid,
As per my understanding, you are trying to plot the eigen values of a 4x4 matrix and are facing some error with it.
To perform an assignment operation, the dimensions of the matrices must be equal. For any given iteration, the matrices "C" & "y" have the dimensions 4x1 & 1x1 respectively, making the dimensions incompatible.
One workaround for this, is to change the indices of the matrix "y" as shown below:
y(:,p)=C;
You can refer to the documentation of array indexing, for more info:
Hope this answer helps you.
Thanks,
Bhanu Prakash.
Voir également
Catégories
En savoir plus sur Octave dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!