trouble displaying my BPM on the title graph when running the code can someone show me how to do this
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
clear all
a= arduino('COM3','Uno')
interv=200;
time=1
x=2.0
last=0;
upflag=0;
while(time<interv)
b=readVoltage(a,'A0');
x=[x,b];
time=time+1;
plot(x,'ro-')
xlabel('Samples');
ylabel('Electrical Activity');
title(sprintf('time=%g[s],BPM= %f',time(end)));
grid on;
hold on;
drawnow
%highpass filtering
h=fir1(interv,1/interv*2,'high');
x_filter=filter(h,1,b );
plot(x_filter);
hold on
%squaring the singal
detsq=x_filter.^2;
plot(detsq);
pulse=zeros(length(detsq),1);
for i=length(detsq)
if(detsq(i)>3)
if(upflag)==0
if ( last>0)
interv=200;
time= i-last;
p= interv/time*60
pulse(i)=p;
end
last = i;
end
upflag=100;
else
if (upflag >0)
upflag=upflag-1;
end
end
end
end
1 Kommentar
Walter Roberson
am 17 Jun. 2018
This looks to be the same as https://www.mathworks.com/matlabcentral/answers/405983-how-can-i-display-on-a-figure-s-title-block-data-as-the-code-is-running-i-was-able-to-do-it-for-tim which is waiting for a response from you.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!