フィルターのクリア

I want to calculate the moving rms of accelerometer data.

113 ビュー (過去 30 日間)
Daniel Du Toit
Daniel Du Toit 2023 年 6 月 30 日
コメント済み: Star Strider 2023 年 6 月 30 日
Hi
I am working on a project where I get accelerometer data with a vector containing the acceleration (1019970 samples) and another vector containg the time corresponding to the acceleration vector. The sampling time is 1.6667e-04. I want to calculate the moving rms of this signal according to the signal. The formulas I have are for the integral notation and for the discrete time notation as seen below.
How would I implement this in matlab to obtain the moving rms for the acceleration vector (without using simulink).

採用された回答

Star Strider
Star Strider 2023 年 6 月 30 日
Try something like this —
Fs = 5000;
T = 100;
t = linspace(0, T*Fs, T*Fs-1)/Fs;
s = sin(2*pi*t*25);
xrms = @(s, n) sqrt(movmean(s.^2, n)); % Calculate RMS Function, 'n': Window Of Consecutive Data
figure
plot(t, s, 'DisplayName','Signal')
hold on
plot(t, xrms(s,100), 'DisplayName','RMS(Signal)')
hold off
grid
legend('Location', 'best')
xlim([0 1])
The ‘xrms’ function produces the expected result of for the RMS value of a sine signal (after a short initial transient) over 100 data points (in this example).
.
  7 件のコメント
Daniel Du Toit
Daniel Du Toit 2023 年 6 月 30 日
thanks a lot
Star Strider
Star Strider 2023 年 6 月 30 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Generation and Preprocessing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by