Iterative approach for plot function
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to find a way to summarise the following lines of code to some sort of for loop with switch statements. Notice the trend and repetition inside the plot functions.
plot([X 0],[-Ystep -Ystep],'b-','LineWidth',2); hold on
plot([0 0],[-Ystep -2*Ystep],'r-','LineWidth',2); hold on
plot([0 X],[-2*Ystep -2*Ystep],'b-','LineWidth',2); hold on
plot([X X],[-2*Ystep -3*Ystep],'r-','LineWidth',2); hold on
plot([X 0],[-3*Ystep -3*Ystep],'b-','LineWidth',2); hold on
plot([0 0],[-3*Ystep -4*Ystep],'r-','LineWidth',2); hold on
...
Any help?
Many thanks, Mo
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!