plot from while loop
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, to be general, suppose i have written the following code
s=0
figure
while s<10
s=s+0.05
n= (µ-s)./nthroot((µ<s).*(s-µ),3)
plot (s,n)
end
when running, this code is giving me the values of n as points that corresponds to each value of s However, I want to get all the values of n in an array and then to plot them
Thank you to tell me how to modefy the previous code to do this
BEST REGARDS
[EDITED, Jan, code formatted]
0 comentarios
Respuestas (2)
Jan
el 23 de Sept. de 2012
figure
s = 0:0.05:10;
n = zeros(1, length(s));
for ii = 1:length(s)
n(ii) = (my - s(ii)) ./ nthroot((my < s(ii)) .* (s(ii) - my), 3);
end
plot(s,n);
0 comentarios
Azzi Abdelmalek
el 23 de Sept. de 2012
Editada: Azzi Abdelmalek
el 23 de Sept. de 2012
close all
s=0;mu=0.5
figure
set(gca,'xlim',[0.5 10],'ylim',[-5 0])
while s<10
s=s+0.05
n= (mu-s)./nthroot((mu<s).*(s-mu),3)
hold on;plot (s,n,'*r');pause(0.05)
end
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!