trouble displaying my BPM on the title graph when running the code can someone show me how to do this

2 vues (au cours des 30 derniers jours)
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

Réponses (0)

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by