随着时间变化的Matlab图 [英] Matlab Plot that changes with time
本文介绍了随着时间变化的Matlab图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试绘制随时间变化的图形(可以将其绘制为随风通过时绘制杆的形状,因此我想每秒绘制一次形状).
I am trying to plot a figure that changes with time (think of it as plotting the shape of a pole as the wind passes through it, so I want to plot the shape at every second).
为避免x轴限制频繁变化,我想将其固定为限制(绘制前计算出的最大值和最小值).这是我的代码示例:
To avoid the x axis limit changing frequently I want to fix it to the limits (max and min that I calculate before plotting). Here is a sample of my code:
for i=1:1:numberofrows
momentvaluesatinstant = momentvalues(i,:);
figure(1)
plot(momentvaluesatinstant,momentheader)
drawnow
title(sprintf('Moment profile along pile at time 0.2%f',time(i)'))
xlabel('Moment (kN.m)')
xlim([momentvalues(rowminmoment) momentvalues(rowmaxmoment)])
ylabel('Length of pile (m)')
delay(1);
end
尽管我将x轴的极限值固定为我指定的值,但是该图会根据要绘制的数据不断更改极限值?有什么我想念的吗?
Although I am specifying the limits of the x axis to be fixed to the values I specify, the plot keeps changing the limits depending on the data being plotted? Is there something I am missing?
推荐答案
想通了,需要添加xlim manual
这篇关于随着时间变化的Matlab图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文