How to plot 3 functions inside if loop??
Mostra commenti meno recenti
function y=h(x,a,b,lf,t)
v=length(x);
for i=1:1:v
Q=((a-(2*a+lf-x(i)))/a)^2;
Z=sqrt(1-Q);
S=((a-x(i))/a)^2;
T=sqrt(1-S);
if ((x(i)>=(lf+a))&&(x(i)<=(lf+2*a)))
plot y(i)=((2*b)+(t)-((2.*b).*Z));
end;
if ((x(i)>=0)&&(x(i)<=a))
plot y(i)=((2*b)+(t)-2*b*T);
end;
if ((x(i)>=a)&&(x(i)<=(lf+a)))
plot y(i)=(t);
end;
end;
Risposte (2)
Image Analyst
il 11 Giu 2013
Look up plot() in the help. You're not even close to using it correctly. You need to set up y on a separate line, then do
y = 2*b.....whatever.
plot(t, y, 'b-');
hold on;
I don't believe the loop over i is even needed.
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!