Get max values from a table
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
From the attached .mat file i would like to get the max values. See picture below, there are 4 peaks, i would like to get all the max x and y values.
1 comentario
Adam Danz
el 12 de Dic. de 2018
Your mat file conains one variable 'Ft2' that is a 2669x2 table. Each element of the table is a 1x11 char such as '2.30002e-01'. Since you've plotted the data, you must have converted them to numeric arrays. If you attach numerical data it will be a lot easier to help you.
For starters, have you tried using findpeaks()?
Respuestas (2)
Jan
el 12 de Dic. de 2018
As adam said already, import the data numerically, not as strings.
The signal looks like a mix of two frequencies. Do you want to remove the high frequence noise at first? Then finpeaks will be more accurate.
0 comentarios
Luna
el 12 de Dic. de 2018
Editada: Luna
el 12 de Dic. de 2018
Hi Jesse,
Please try this below. This code actually finds the 4 max values.
But also you can try to get a moving average (using smooth function to get rid of noise in your signal.)
load('matlab.mat')
xValues = str2num(Ft2.time); % convert x values: time
yValues = str2num(Ft2.combi); % convert y values: combi
[PKS,LOCS]= findpeaks(yValues,'MinPeakDistance',300); % find peaks with avoiding noisy peaks
peakTimeStamps = xValues(LOCS(PKS>10000)); % find peaks as local max and find time stamps of them
peakValues = PKS(PKS>10000); % get the peak values with same filter
% plot
plot(xValues,yValues);
hold on;
plot(peakTimeStamps,peakValues, 'ro');
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!