How to stop the program and store the scalar variable and rerun the program and plot scalar against scalar
1 次查看(过去 30 天)
显示 更早的评论
Hi, I want to plot scalar value (t) against scalar (alpha). But it does not plot.
Simplified code is below:
da = 0.1
for i=1:31;
alpha = (1-1)*da
...
for nt=1:30001;
t=t+dt
...
if (gap2 < 10^(-8)) |(gap2 < 10^(-8))
plot (t,alpha)
break
end
end
Thanks
0 个评论
采纳的回答
rantunes
2015-3-4
Hey,
As I can understand from your code, you have alpha = 0, no?
And another thing is that you want to plot each point at each iteration, right? You should try to use the "hold on" command, for the plot function "overwrite" in the first opened plot the next points. Maybe you should save the points in vectors, and plot it outside the external cycle for.
Greets
5 个评论
rantunes
2015-3-4
Okay, I understand what do you mean about the plotting, but in any case you have to use "hold on".
In any case, I still don't know how alpha, alpha = (1 - 1)*da, should increase at each iteration.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!