フィルターのクリア

smoothing a graph using matlab

1 回表示 (過去 30 日間)
Abeer Aboul Azm
Abeer Aboul Azm 2022 年 2 月 20 日
コメント済み: Star Strider 2022 年 2 月 20 日
how can I smooth data imported from one column (Excel sheet) using Matlab
how to smooth the corners?

採用された回答

Star Strider
Star Strider 2022 年 2 月 20 日
A frequency-selective filter can preseerve the essential shape of the signal, eliminating only the high-frequency oscillations in the ‘valleys’.
Try this —
V1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/900720/data.xlsx');
L = numel(V1);
t = linspace(0, L-1, L);
Ts = t(2)-t(1);
Fs = 1/Ts;
Fn = Fs/2;
NFFT = 2^nextpow2(L);
FTV1 = fft(V1,NFFT);
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTV1(Iv))*2)
grid
xlabel('Frequency')
ylabel('Amplitude')
title('Fourier Transform (Detail)')
xlim([0 0.05])
UpperPassband = 0.023;
V1F = lowpass(V1, UpperPassband, Fs, 'ImpulseResponse','iir');
figure
subplot(2,1,1)
plot(t, V1)
grid
title('Original')
subplot(2,1,2)
plot(t, V1F)
grid
xlabel('Time')
title('Filtered')
Adjust the ‘UpperPassband’ frequency to produce the desired result.
.
  2 件のコメント
Image Analyst
Image Analyst 2022 年 2 月 20 日
This looks like it maintains the shape of the "good" part better than the Savistky-Golay filter.
Star Strider
Star Strider 2022 年 2 月 20 日
I like the sgolayfilt function and use it to filter broadband noise. However, this is band-limited noise (the reason I did the fft was to determine that) so a frequency-selective filter works best in this instance.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 2 月 20 日
You could use sgolayfilt() to fit a sliding window to the data. Window width would be about the width of one of those humps. It looks kind of like a sine or cosine wave thus you can fit it to a 4th or 5th order polynomial. Attach your data if you need more help.
  6 件のコメント
Abeer Aboul Azm
Abeer Aboul Azm 2022 年 2 月 20 日
Thank you so much
Image Analyst
Image Analyst 2022 年 2 月 20 日
編集済み: Image Analyst 2022 年 2 月 20 日
If it worked, can you click "Accept this answer" for the best answer? Thanks in advance.

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

カテゴリ

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