Plotting eigen values for different i values in a matrix

조회 수: 14 (최근 30일)
Aishah Malek
Aishah Malek 2018년 8월 23일
답변: Christine Tobler 2018년 8월 23일
I have a matrix, where i can compute eigen values. I want to have a graph that shows the change in eigen values when it is altered between 0 and 1 , i have tried to do this using a for loop but when i run the code, only the first set eigen values are plotted. Any advice on how i can alter this?
a=1;
b=1.2;
%equilibrium values
%c1 equilbrium value
c1=1;
c2=(a*c1/b);
c3=(a*c1/b)^2;
c4=(a*c1/b)^3;
for i=0:1
D=[-50*a-b+15*a*c3+20*a*c4+12*a*c2-4*i*a*c2,15*a*c2+b+18*a*c3-60*a+24*a*c4,20*a*c2-80*a+24*a*c3+32*a*c4-b*i]
E=[10*a-a*c3-4*a*c4-4*a*c2,-a*c2-b+6*a*c3-10*a+4*a*c4,4*a*c3+b-4*a*c2]
F=[-2*a*c3+2*i*a*c2,-6*a*c3+10*a-4*a*c4,-4*a*c3-b-b*i]
A=[D;E;F]
G=(eig(A))
plot(G)
end

답변 (1개)

Christine Tobler
Christine Tobler 2018년 8월 23일
After calling plot, use hold on so that the first plot doesn't get overwritten when calling plot a second time.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by