Several statements in if condition plotting and drawing arrow

1 次查看(过去 30 天)
Hello,
My code is like this:
...
for nt=1:10001
t=(nt-1)*dt
...
if nt==1 | nt==101 | nt==1001
baseLine = 0; %# Baseline value for filling under the curves
index = 1:101; %# Indices of points to fill under
figure(3)
plot(xx,body_up,'k','Linewidth',1.5); %# Plot the first line
hold on; %# Add to the plot
h1 = fill(xx(index([1 1:end end])),... %# Plot the first filled polygon
[baseLine body_up(index) baseLine],...
'y','EdgeColor','none');
plot(xx,body_down,'k','Linewidth',1.5); %# Plot the second line
h2 = fill(xx(index([1 1:end end])),... %# Plot the second filled polygon
[baseLine body_down(index) baseLine], 'w','EdgeColor','none');
plot(xx(index),baseLine.*ones(size(index)),'r'); %#Plot the red line
title(['...=',num2str((nt-1)/(10000))]);
drawnow
end
end
The question >>
I want to show an arrow for each u and p in each time in the figure using latex. But when I use this code it shows just last nt value in if condition (1001) in the title.
Any help, please!
  3 个评论
Meva
Meva 2015-12-28
Thanks I already know how to show an arrow for a single line. What I just asked was a bit complicated.
Image Analyst
Image Analyst 2015-12-28
Meva you didn't really ask a question - you just said what you want and that was " I want to show an arrow", which is sort of an implied question. The function annotation() will allow you to draw arrows but then you said you knew how to draw arrows, so what is the question? Is it how do you do it in Latex? Can you ask an actual question starting out like "How do I .....?" because as of now, we don't know what your question is.

请先登录,再进行评论。

采纳的回答

dpb
dpb 2015-12-29
"...But when I use this code it shows just last nt value in if condition (1001) in the title."
Surely. Because (quoting from documentation) " title sets the Title property of the current axes graphics object to a new text graphics object."
Since there's only one Title property, you overwrite displayed title each pass thru. Not sure what you want as an end result, but that's the cause of the symptom. Perhaps you intend to create multiple figure 's instead of only one by the repeated use of the fixed integer handle '3'; I don't know???

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by