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

4 Ansichten (letzte 30 Tage)
Roa am 5 Dez. 2022
Beantwortet: Gokul Nath S J am 8 Dez. 2022
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
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Gokul Nath S J am 8 Dez. 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.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

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