我已經繪製出來的圖表和我有一些是在這裏繪製圖形的MATLAB峯值(中發現的峯值,但想知道的價值)
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軸值或計算值。
在if語句中,您已經擁有了所有需要的東西。在'if'裏面你可以添加'峯值(beat_count)= pbcg(k);',並且你會在峯值中得到峯值的Y值。 – Adiel
沒有理由感到抱歉。你的情況很好。我的意思是你應該在'beat_count = Beat_count + 1'這行後面加上另一行,並且在'end'之前。 – Adiel
@Adiel非常感謝!我知道你的意思,我設法得到高峯..謝謝! – myfriday13