Effacer les filtres
Effacer les filtres

plotting

1 vue (au cours des 30 derniers jours)
mohamed saber
mohamed saber le 2 Avr 2012
this is my code clear,clc l=.01; m=.01; for x=0:.00001:l; zeta=(m.*cosh(l-x))./(cosh(m.*l)); plot(x,zeta),hold on end
i want to plot many graphs by change values of m , for example m= [0,.02,.4] ... how can i do it without repeat the code ?

Réponses (2)

Matt Kindig
Matt Kindig le 2 Avr 2012
Put m in a loop as well.
clear,clc
l=.01;
for m=0:.01:4;
figure; %create a new figure each time
for x=0:.00001:l;
zeta=(m.*cosh(l-x))./(cosh(m.*l));
plot(x,zeta),hold on
end
end

Thomas
Thomas le 2 Avr 2012
Another way
clc
clear all
l=.01;
m=0:0.02:4;
x=0:.00001:l;
for count1=1:length(m)
for count2=1:length(x)
zeta(count1,count2)=(m(count1).*cosh(l-x(count2))./(cosh(m(count1).*l)));
end
end
plot(x,zeta)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by