How can I Plot a graph in real time

Hello everybody. I am kind of new to plotting, and I am trying to create a graph that updates every one second. Every one second I get a number from a device (for my y-axis), and ecerytime I get a number I want the graph to plot it on a time x-axis.
I would also like to change the xlim everytime it reaches the ebd, so the picture will "move" to the right with the plotting.
Any ideas?
Thanks in advance, Sagi.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 10일

0 개 추천

Look at this example
figure
hold on
for k=1:100
y(k)=sin(k)
pause(1)
plot(y)
end

댓글 수: 1

Sagi Sagi
Sagi Sagi 2016년 7월 10일
Thanks for the quick reply!
Your code plots the sin(x) function on 1 second jumps, which is great for me. My only problem is, that the lim(x) is growing insted of moving (changing from 0-20 to 0-30 instead of 1-21).
Any way you can help me do it?
Thanks, Sagi.

댓글을 달려면 로그인하십시오.

카테고리

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

제품

태그

질문:

2016년 7월 10일

댓글:

2016년 7월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by