How to draw a line using drawnow command?

Here is the code I have computed y and I need to plot it with respect to x. for r=2:length(x); plot(x(r-1),y(r-1),'--') plot(x(r),y(r),'--'); hold on drawnow; end butthie is giving me dotted line instead of a dashed line

답변 (1개)

Iain
Iain 2013년 5월 20일

0 개 추천

You should change your plot command to:
plot(x,y,'.-')
If you want it to centre start at (0,0), you can instead have:
plot(x-x(1),y-y(1), '.-')
Change the '.-' as suited for your desired plot style.
drawnow only tells matlab to actually draw the graph, which is important if you want to see the chart being generated while matlab can keep executing other code

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

질문:

2013년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by