How to find the end value of a flat minimum peak in a noisy data?

5 次查看(过去 30 天)
Hi!
I have a problem finding the end value of minimum flat peaks. I have angular displacement data form a dinamometer. But this data is a tranmitted signal to an EMG system, so the y axis shows voltage, that's why the scaling is unusual. The original data had noise which I filtered (see below). The offset of the signal is varying from measurament to measurament.
I used findepeak for locating the peaks which are the end points of the tasks. I used high tresholds therfore it was easy to find these peaks. I red circled the points I'm trying to locate, that's where the task is started. However, I cannot solve the issue here. The findpeak function does not have an option for a flat peak, and islocalmin influanced by the small noise in the dataset. It is already filtered but still have small noise wich interfere with the islocalmin function. I don't know how should I filter more the dataset or how to locate the flat end with the slightly noisy data with different approach. Does anybody can help? I think it is not a big problem only for me, but please let me know if you have any suggestion.
Thanks!
I use this script:
load ('angle.mat');
%% I used this basic lowpass filter on the raw data
% Fs = 2000;
% N = 4;
% Fc = 10;
% h = fdesign.lowpass('N,F3dB', N, Fc, Fs);
% Hd = design(h, 'butter');
% Angle = filter (Hd, Angle);
%% I found the max peak like this (These are the end points for the task)
[Maxima2,MaxIdx2] = findpeaks(Angle, 'MINPEAKHEIGHT',10, 'MINPEAKDISTANCE', 5000);
index_end=[Maxima2,MaxIdx2];
%%I don't have idea how to find the starting points.

回答(1 个)

Chunru
Chunru 2022-8-24
load(websave("angle.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1106205/angle.mat"))
whos
Name Size Bytes Class Attributes Angle 84337x1 674696 double cmdout 1x33 66 char
t = 1:length(Angle);
flatmin = islocalmin(round(Angle/40), 'FlatSelection', 'last');
plot(t, Angle, t(flatmin), Angle(flatmin), 'r*')

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by