I have data how do I know what number to specify for my MinPeakHeight and MinPeakDistance?

조회 수: 3(최근 30일)
Roa 2022년 12월 5일
답변: Gokul Nath S J 2022년 12월 8일
I have been given data and I am expected to find the below;
• The total number of steps
• The total distance walked
• The calorie expenditure
I have done this so far to find the steps:
max_num_steps = 130;
frq = 10;
min_dist = floor(frq * (60/max_num_steps));
[pksval, pksloc] = findpeaks(mag, 'MinPeakHeight', 12, 'MinPeakDistance', min_dist, 9);
n_steps = numel(pksval);
But my question how do I know what numbers to set my 'MinPeakHeight' and 'MinPeakDistance' to? I think 12 and 9 are not giving me the correct readings.
Many thanks

댓글을 달려면 로그인하십시오.

답변(1개)

Gokul Nath S J 2022년 12월 8일
Hi Roa,
I assume that you have the magnitude of a mathematical function ‘mag’ and you want to find it’s local maxima. If you want to find all the maxima points with their x-axis locations, you can simply use the following command,
x = linspace(min_x, max_x, 1000);
[pks,locs] = findpeaks(mag, x);
Note that you only need to pass ‘MinPeakDistance and ‘MinPeakDistance’ arguments if you need to narrow down you search to few peaks. If needed these are user dependent and needs to be manually set according to the situation.

댓글을 달려면 로그인하십시오.

범주

Find more on Spectral Measurements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by