Trouble using findpeaks function
Afficher commentaires plus anciens
The attached data is a sinusodial wave. I want to find how many peaks are in this graph. In matlab, I click on the file and import thata data from both columns. I get the following error:
Error using findpeaks
Expected Y to be one of these types:
double, single
Instead its type was table.
Error in findpeaks>parse_inputs (line 199)
validateattributes(Yin,{'double','single'},{'nonempty','real','vector'},...
Error in findpeaks (line 135)
= parse_inputs(isInMATLAB,Yin,varargin{:});
So importing the data that way makes it a table.
Ok so i make a variable for each column and turned them into a 5464x1 matrix.
Im not sure what to do next in order to analyze the peaks. ANy help?
Réponses (1)
I have no idea how you are importing them. The findpeaks function wants real vector data.
Try something like this —
T1 = readtable('run 4 vac to air volt.csv', 'VariableNamingRule','preserve')
ChA = T1{:,1};
ChB = T1{:,2};
[pksA,locsA] = findpeaks(ChA, 'MinPeakProminence',0.01);
[pksB,locsB] = findpeaks(ChB, 'MinPeakProminence',0.01);
figure
subplot(2,1,1)
plot(ChA)
hold on
plot(locsA,pksA, '+r')
hold off
hold on
hold off
subplot(2,1,2)
plot(ChB)
hold on
plot(locsB,pksB, '+r')
hold off
Make appropriate changes to get the results you want.
.
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
