Removing a particular legend from plot
Show older comments
clear all
clc
k1=0.7;
k2=01;
wf=1;
ws=1.5;
b=0.15;
d=0.15;
a=0.15;
h=0.05;
j=0;
l=0;
ns1=0;
ns2=0;
nu=0;
for Zf= 0.01:0.01:1.5
n=0;
zf=Zf;
u7=-pi;
u5=pi*(wf^2 + 2*zf*(a + h)*wf + ws^2 + a*h + 1);
u3=(-pi*(wf^2*(ws^2 + a*h + 1) - k1*k2 + ws^2 + 2*wf*zf*(h*ws^2 + a)));
u2=8*b*d*wf*ws^2*zf;
u1=pi*(wf^2*ws^2 - k1*k2*ws^2);
v6=pi*(a + h + 2*wf*zf);
v4=(-pi*(a + wf^2*(a + h) + h*ws^2 + 2*wf*zf*(ws^2 + a*h + 1)));
v3=4*b*d*ws^2;
v2=pi*(wf^2*(h*ws^2 + a) + 2*wf*ws^2*zf - a*k1*k2);
v1=(-4*b*d*wf^2*ws^2);
j4=v3*u7;
j3=v3*u5+v1*u7-u2*v6;
j2=v3*u3+v1*u5-u2*v4;
j1=v3*u1+v1*u3-u2*v2;
j0=v1*u1;
j=[j4 j3 j2 j1 j0];
jr=roots(j);
w=jr.^0.5;
for i=1:size(w)
if imag(w(i,1))==0
o=w(i,1);
A=-u2*o^2/(u7*o^7+u5*o^5+u3*o^3+u1*o);
if A>0
d1=6*A*pi*(a + h + 2*wf*zf)*o^5 + (-4*A*pi*(a + wf^2*(a + h) + h*ws^2 + 2*wf*zf*(ws^2 + a*h + 1)))*o^3 + 12*b*d*ws^2*o^2 + 2*A*pi*(wf^2*(h*ws^2 + a) + 2*wf*ws^2*zf - a*k1*k2)*o - 4*b*d*wf^2*ws^2;
d2=- pi*o^7 + pi*(wf^2 + 2*zf*(a + h)*wf + ws^2 + a*h + 1)*o^5 - pi*(wf^2*(ws^2 + a*h + 1) - k1*k2 + ws^2 + 2*wf*zf*(h*ws^2 + a))*o^3 + pi*(wf^2*ws^2 - k1*k2*ws^2)*o;
d3=(-7*pi*A)*o^6 + 5*A*pi*(wf^2 + 2*zf*(a + h)*wf + ws^2 + a*h + 1)*o^4 + (-3*A*pi*(wf^2*(ws^2 + a*h + 1) - k1*k2 + ws^2 + 2*wf*zf*(h*ws^2 + a)))*o^2 + 16*b*d*wf*ws^2*zf*o + pi*A*(wf^2*ws^2 - k1*k2*ws^2);
d4=pi*(a + h + 2*wf*zf)*o^6 - pi*(a + wf^2*(a + h) + h*ws^2 + 2*wf*zf*(ws^2 + a*h + 1))*o^4 + pi*(wf^2*(h*ws^2 + a) + 2*wf*ws^2*zf - a*k1*k2)*o^2;
D=d1*d2-d3*d4;
l=l+1;
R(l,1)=A;
R(l,2)=o;
R(l,3)=D/abs(D);
end
end
end
R=sortrows(R,-1);
for k=1:size(R,1)
if R(k,3)==1
n=n+1;
if n==1;
ns1=ns1+1;
As1(ns1)=R(k,1);
Zfs1(ns1)=zf;
elseif n==2
ns2=ns2+1;
As2(ns2)=R(k,1);
Zfs2(ns2)=zf;
end
end
if R(k,3)==-1
nu=nu+1;
Au(nu)=R(k,1);
Zfu(nu)=zf;
end
end
R=0;l=0;
end
if ns1>0
plot(Zfs1,As1,'-k')
hold on
end
if ns2>0
plot(Zfs2,As2,'-k')
hold on
end
if nu>0
plot(Zfu,Au,':k')
end
legend
You can see the plot data 1 and data 2 are ploted with same property of line therefore i want to rmove the legend even the legend mark from data 2
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots 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!

