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?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
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
Accepted Answer
Azzi Abdelmalek
on 19 Sep 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 Comments
Thanks Azzi..Can I take still picture of moving line at different times.
What do yoju mean?
[Aniket Kumar commented]
Can I take still picture of moving line at different times.
Your comment is not clear
I can see the line is moving with constant speed. I want to capture some image at different location of line say when line is in middle of square and other locations.
What do you mean by capture?
I want to take different plots/image of line at different location rather than moving line from bottom to top.I mean, I want to show, at time t=0, line is at bottom, then after some time , it is at different position through images,means images for different time.
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])
thanks Azzi
More Answers (0)
Categories
Find more on Polar Plots in Help Center and File Exchange
See Also
on 19 Sep 2013
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)