How to generate a line at the bottom of square and then movement of line from bottom to top side of square with a constant speed?

3 visualizzazioni (ultimi 30 giorni)
I want to generate a straight line at bottom of a square and then move to line from bottom side of square to top side of square with a constant speed and want to see in plot at different times, where line exist (visualization).
Thanks

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 19 Set 2013
x=[0 10]
figure;
plot([0 10 10 0 0],[0 0 10 10 0],'r')
xlim([0 10])
ylim([0 10])
hold on;
for k=0:0.01:10
h=plot(x,[k k])
pause(0.01);
delete(h)
end
  9 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 19 Set 2013
x=[0 10]
figure;
hold on
plot([0 10 10 0 0],[0 0 10 10 0],'r')
xlim([0 10])
ylim([0 10])
position=3;
h=plot(x,[position position])

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by