フィルターのクリア

How can i change my x-axis to read real time

3 ビュー (過去 30 日間)
Carlos Nunez
Carlos Nunez 2018 年 7 月 3 日
回答済み: Mridul G 2018 年 7 月 3 日
clear all; a= arduino('COM3','Uno')
x=[]; t=[]; Fv=50; BPM=0; order=8 tic; for k=1:1000 toc; b=readVoltage(a,'A0'); x=[x,b]; t=[t;toc]; delta_t=diff(t);% Gave me the average of delta t tf=mean(delta_t)% Gave me the mean for the delta t fs=1./tf % Frequency %This will plot the samples of raw data that the pusle sensor is %reading into Matlab. It will display the graph of the raw data and %extract the data points in order to convert to ECG(heart single
%Low pass filter
cutt_off=[8/Fv/2]; % the 8 represents the lowest number of frequncy the
%code is runnin at
h=fir1(order,cutt_off);
con=conv(x,h);
beat_count=0; for k=2:length(con)-1 %This lets Matlab know what I'm looking for in the peaks if( con(k)> con(k-1) & con(k)> con(k+1) & con(k)>1); beat_count = beat_count + 1; end N = length(con); duration_in_seconds = N./fs; duration_in_mintues= duration_in_seconds/60; BPM = beat_count./duration_in_mintues;
end
figure(1)
plot(t,con);
xlabel('Time(s)');
ylabel('Electrical Activity');
title(sprintf('t=%g[s],BPM= %f',t(end),BPM(end)));
grid on;
drawnow;
end

採用された回答

Mridul G
Mridul G 2018 年 7 月 3 日
you may consider axis shifting x1, dx y1 y2 constant axis([x1 x1+dx y1 y2]) and apply drawnow after each plot so the graph is updated

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by