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

1 view (last 30 days)

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 9 Nov 2021
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')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by