Error in Build,deploy android app model using Accelerometer sensor.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen

function [peaks, peakno]= Accelerometerdata(Acceleration)
z = Acceleration.Z;
smtlb = sgolayfilt(z,9,21);
peaks=findpeaks(smtlb,t,'MinPeakDistance',1);
peakno=numel(findpeaks(smtlb));
end
0 Kommentare
Antworten (1)
Walter Roberson
am 31 Jan. 2023
Is there a particular reason your last line is not
peakno = numel(peaks);
??
I would suggest that you pre-allocate peaks and that you pass the maximum size as NPeaks to findpeaks() . That will prevent Simulink from complaining about peaks being unknown size.
5 Kommentare
Walter Roberson
am 8 Feb. 2023
Suppose that you did manage to return a variable-length list of peak heights. What would you do with the variable-length list downstream ?
Siehe auch
Kategorien
Mehr zu Signals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!