Hi everyone, please ask a question. How to remove bad values and filter the experimental data.The data is shown below.

2 ビュー (過去 30 日間)
  4 件のコメント
Chris
Chris 2021 年 11 月 9 日
編集済み: Chris 2021 年 11 月 9 日
Okay, there is actually a bad value in this vector. You can find it with
badValues = ~isfinite(x);
Then you could choose whether to delete it, or replace it with a 0 or an averaged value based on neighboring values.
After that, you should be able to apply a low-pass filter to quiet the high-frequency noise if you have the Signal Processing Toolbox, or smoothdata, or something along those lines.
Image Analyst
Image Analyst 2021 年 11 月 9 日
I already repaired the data. Don't miss my answer below.

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

採用された回答

Image Analyst
Image Analyst 2021 年 11 月 9 日
Try movmean():
s = load('24v.mat')
u = s.u;
x = 1 : length(u);
% Interpolate nans
nanLocations = isnan(u);
u = interp1(x(~nanLocations), u(~nanLocations), x)
% Now u has been "repaired" by filling in nans.
% Plot repaired data.
plot(x, u, 'b-')
grid on;
% Smooth with movmean() function.
smoothu = movmean(u, 201);
% Plot smoothed data.
hold on;
plot(smoothu, 'r-', 'LineWidth', 4)
xlabel('Index', 'FontSize',17);
ylabel('Signal', 'FontSize',17);
legend('Original Signal', 'Smoothed Signal')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by