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

3 views (last 30 days)
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

Answers (1)

Gokul Nath S J
Gokul Nath S J on 8 Dec 2022
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

Categories

Find more on Simulation, Tuning, and Visualization 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!