I have data how do I know what number to specify for my MinPeakHeight and MinPeakDistance?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(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.
Please refer to the article for more information
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!