Error in Build,deploy android app model using Accelerometer sensor.

6 次查看(过去 30 天)
function [peaks, peakno]= Accelerometerdata(Acceleration)
z = Acceleration.Z;
smtlb = sgolayfilt(z,9,21);
peaks=findpeaks(smtlb,t,'MinPeakDistance',1);
peakno=numel(findpeaks(smtlb));
end

回答(1 个)

Walter Roberson
Walter Roberson 2023-1-31
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 个评论
Walter Roberson
Walter Roberson 2023-2-8
Suppose that you did manage to return a variable-length list of peak heights. What would you do with the variable-length list downstream ?
Kelvin John
Kelvin John 2023-2-8
plot the accelerometer signal, to show the peaks in the signal to determine the number of peaks in the signal

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Signals 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by