why is my plot not showing anything
Show older comments
close all;
clc
q=1;
beta=0.28;
teta=30*pi/180;
a=1;
mu=0.72;
k=2;
c=300;
for v0=80:0.5:180;
u0=v0-10;
alfa1=mu*(k-1/2)/(k-3/2);
alfa2=mu*(k-1/2)*(k+1/2)/(2*(k-3/2)^2);
gama1=(1+3*a*u0^2)/(2*c^2);
eta1=1+3*a*v0^2/(2*c^2);
x1=alfa1;
x2=-2*alfa1*u0*cos(teta)+2*alfa1*v0*cos(teta);
x3=-q*beta*cos(teta)^2/eta1-cos(teta)^2/gama1+alfa1*u0^2*cos(teta)^2+alfa1*v0^2*cos(teta)^2+4*alfa1*v0*u0*cos(teta)^2;
x4=2*u0*q*beta*cos(teta)^3/eta1+2*v0*cos(teta)^3/gama1-2*alfa1*v0^2*cos(teta)^3*u0-2*alfa1*v0*u0^2*cos(teta)^3;
x5=-q*beta*cos(teta)^4*u0^2/eta1-v0^2*cos(teta)^4/gama1+alfa1*v0^2*u0^2*cos(teta)^4;
y=[x1,x2,x3,x4,x5];
landa=roots(y);
if isreal(landa(4))
plot(v0,landa(4));
hold on;
end
end
Answers (2)
Azzi Abdelmalek
on 1 May 2016
0 votes
landa is always a complex number.
4 Comments
Mohammad Alavi
on 1 May 2016
Azzi Abdelmalek
on 1 May 2016
Do you want to plot only real roots?
Mohammad Alavi
on 2 May 2016
Azzi Abdelmalek
on 2 May 2016
Ok,landa contains only complex numbers. What do you want to do with them?
Walter Roberson
on 2 May 2016
There are no real roots in the range v0 = 80 to 180. The two real roots are
v0 = -2.9519709800851799940292844879542507513708021691910
v0 = 22.904282241682175870334381209712496165896259534707
The equation is a quartic in which only two of the roots are real. By the range v0 80 to 180, the imaginary components are unquestionably non-zero .
Categories
Find more on Numerical Integration and Differentiation 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!