我已经绘制了图表,我得到了一些代码
fs = 100; %freq 100hz
N = length(pbcg); %data length, before that do a pbcg=load('pbcg.txt')
duration_in_seconds = N/fs;
duration_in_minutes = duration_in_seconds/60;
BPM_avg = beat_count/duration_in_minutes;
fid = fopen('y1.txt','a'); %txt naming and append
%count the dominant peaks in the signal
for k = 2 : length(pbcg)-1
if (pbcg(k) > pbcg(k-1) && pbcg(k) > pbcg(k+1) && pbcg(k) > 1)
beat_count = beat_count + 1;
end
fprintf(fid, 'x_axis%i\t ', k); %open writer
fprintf(fid, 'BPM%i\n ', BPM_avg); %open writer
end
disp(BPM_avg); %display the BPM
fclose(fid); %close writer
绘制图形的图像在这里(没有插入img的声誉)... https://skydrive.live.com/embed?cid=0525DA685954952E&resid=525DA685954952E%21407&authkey=ALmvTzzQ7Xer2Do
我想知道的是,你可以看到最高的是11peak,我如何在峰值中获得'价值'?因为我想知道如何获得y轴值或计算值。
答案 0 :(得分:0)
我这样做就像@Adiel教的那样......
%determine the bpm
beat_count = 0;
fs = 100; %freq 100hz
N = length(pbcg); %data length, before that do a pbcg=load('pbcg.txt')
duration_in_seconds = N/fs;
duration_in_minutes = duration_in_seconds/60;
BPM_avg = beat_count/duration_in_minutes;
fid = fopen('y1.txt','a'); %txt naming and append
%count the dominant peaks in the signal
for k = 2 : length(pbcg)-1
if (pbcg(k) > pbcg(k-1) && pbcg(k) > pbcg(k+1) && pbcg(k) > 1)
beat_count = beat_count + 1;
peaks(beat_count)=pbcg(k);
end
fprintf(fid, 'x_axis%i\t ', k); %open writer
fprintf(fid, 'BPM%i\n ', BPM_avg); %open writer
end
disp(BPM_avg); %display the BPM
fclose(fid); %close writer
并从matlab命令输入'peak',它显示了我的y轴值的总峰数。因为我确实需要清除“beat_count”和“峰值”,因为每当我'运行'它将使数据量翻倍的功能