I need to know how can i plot a vector over a specific interval? I'm using that to highlight this interval, by plotting the vector values with a different color. So Eventually, i will need to plot the vector as it is first with blue color for example, and then plot that specific interval with red color. Thanks for your time, Regards
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
t = 0:0.01:8*pi;
y = sin(t);
If you want to plot a specific t
interval in red then:
ind = t>2 & t<6;
plot(t,y);
hold on
plot(t(ind), y(ind), 'r')
If you want to plot a specific y
interval in red then:
ind = y>0.5 & y<0.8;
plot(t,y);
hold on
plot(t(ind), y(ind), 'r')