Get max values from a table
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Adam Danz
2018 年 12 月 12 日
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()?
回答 (2 件)
Jan
2018 年 12 月 12 日
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 件のコメント
Luna
2018 年 12 月 12 日
編集済み: Luna
2018 年 12 月 12 日
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 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!