trouble displaying my BPM on the title graph when running the code can someone show me how to do this
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2018년 6월 17일
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.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!