Filter löschen
Filter löschen

Iterative approach for plot function

1 Ansicht (letzte 30 Tage)
Mo
Mo am 26 Mär. 2014
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

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by