Plotting eigen values for different i values in a matrix

15 次查看(过去 30 天)
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