How to continuously real-time plotting graph from arduino to matlab (10k Variable Resistor)
7 ビュー (過去 30 日間)
古いコメントを表示
Hello and good day to all the experts and visitors of Mat-Lab, I am a mechatronic student and now facing problem trying to interface matlab and arduino..
I am trying to real-time plotting graph from arduino to matlab with (10k variable resistor), but the graph will stop plotting after reach the Maximun X-axis (I set 0-1000).
Can it continuously real-time plotting the graph non stop? full of appreciation or teaching me to solve it.
the code is shown below:
a = arduino('COM3');
interv = 1000;
passo = 1;
t=1;
x=0;
while(t<interv)
b=a.analogRead(0);
x=[x,b];
plot(x);
axis([0,interv,0,1024]);
grid
t=t+passo;
drawnow;
end
1 件のコメント
Kerone Naidoo
2017 年 3 月 8 日
Hi,
just dont bound the axis, remove the bounds on the axis and that should allow it to continually plot the voltage.
回答 (6 件)
David Sanchez
2013 年 8 月 13 日
You just have to change the axis when the highest value is reached:
axis([interv,2*interv,0,1024]); % adapt values to your needs
anand
2016 年 12 月 22 日
just make use of while(1) after a = arduino and at the last make use of a end function this solves your problem
0 件のコメント
Sanjay Raam
2014 年 2 月 9 日
編集済み: Sanjay Raam
2014 年 2 月 9 日
you need not set axis between 0to1024
instead give the following statement
axes auto;
by the way, thanks for your program... it was useful for me to learn!!
0 件のコメント
khoulod ghanem
2015 年 9 月 28 日
I am trying to plot current-voltage curve from Arduino to Matlab , can you help me to start ??
0 件のコメント
ravi kumar
2017 年 2 月 2 日
This did not work for me. I tried this one: Real Time Analog Voltage in Matlab using Arduino it uses line function. anybody knows how to scroll the time line?
1 件のコメント
prasad noolu
2017 年 8 月 17 日
編集済み: prasad noolu
2017 年 8 月 17 日
try this code: clear all
a = arduino
x = 0;
for k = 1:1000
b = readVoltage(a, 'A0');
x = [x, b];
plot (x);
grid;
drawnow;
end
Madhu Govindarajan
2017 年 10 月 17 日
Checkout this video - https://www.mathworks.com/videos/plotting-live-data-of-a-temperature-sensor-using-arduino-and-matlab-121317.html?s_tid=srchtitle
HTH, Madhu
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で MATLAB Support Package for Arduino Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!