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

4 ビュー (過去 30 日間)
Roa
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
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.
Please refer to the article for more information

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by