Iterative approach for plot function

1 回表示 (過去 30 日間)
Mo
Mo 2014 年 3 月 26 日
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 件)

カテゴリ

Help Center および File ExchangeWaveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by