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;
    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

我想知道的是,正如您所见,最高点有 11 个峰值,我如何获得峰值本身的“价值”?正如我想知道如何获得 y 轴值或计算值。

4

1 回答 1

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 命令中输入“峰值”,它会显示我的 y 轴值的峰值总数。但是因为我确实需要清除“beat_count”和“peaks”,因为每次我“运行”该功能时,它都会使数据量翻倍

于 2013-07-09T01:21:43.163 回答