找到峰值但想知道该值

找到峰值但想知道该值

本文介绍了Matlab峰值(找到峰值但想知道该值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经画出了图,我得到了一些代码在这里

i have plot out the graph and i got some of the code which is here

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

image of the plotted graph is here(don't have reputation to insert img)...https://skydrive.live.com/embed?cid=0525DA685954952E&resid=525DA685954952E%21407&authkey=ALmvTzzQ7Xer2Do

我想知道的是,正如您所看到的那样,最高峰为11peak,我如何获得峰本身的价值"?如我想知道如何获取y轴值或计算值.

what i want to know is that as you can see that there is 11peak on the highest and how do i get the 'value' in the peak itself? as in i wanna know how to get either the y-axis value or the calculated value.

推荐答案

我这样做的方式就像@Adiel教的一样.

i do it this way like how @Adiel taught..

%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命令中键入"peaks",它显示了我的y轴峰值总数.但是因为我确实需要清除"beat_count"和"peaks",因为每次我运行"该功能时,它将使数据量加倍

and from the matlab command i type 'peaks' and it show me my total number of peaks with the y-axis value. but of coz i do need to clear the "beat_count" and "peaks" as everytime i 'run' the function it will double up the amount of data

这篇关于Matlab峰值(找到峰值但想知道该值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:39