フィルターのクリア

How to remove harmonics and noises from a signal and reconstruct it?

39 ビュー (過去 30 日間)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA 2023 年 7 月 6 日
編集済み: William Rose 2023 年 7 月 10 日
I have a downsampled sinusoidal signal. Then signal has 32 samples per cycle. It contains harmonics (upto 13th) as well as noises. The actual snusoidal signal is . How can I get the actual sinusoidal signal by removing the harmonics and noises. I have to do it in m.file.
  2 件のコメント
Jonas
Jonas 2023 年 7 月 7 日
what about using a lowpass to remove any harmonics and the noise? which kind of noise is present?
Mathieu NOE
Mathieu NOE 2023 年 7 月 10 日
you can use either a lowpass or a bandpass filter to extract your signal
have a look at

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

回答 (1 件)

William Rose
William Rose 2023 年 7 月 10 日
編集済み: William Rose 2023 年 7 月 10 日
[edit: correct spelling errors]
Make a signal with 32 samples per cycle, and smaller sinusoids at the 2nd, 7th, and 13th harmonic, and noise.
ff=1; % fundamental frequency (Hz)
A=195; % amplitude of fundamental
fs=32*ff; % sampling rate (Hz)
nc=5; % number of cycles of fundamental
sd=A/10; % noise st.dev.
N=nc*fs; % signal length (points)
t=(0:N-1)/fs; % time vector (s)
xf=A*sin(2*pi*ff*t); % fundamental sinusoid
x=xf+(A/2)*sin(2*pi*ff*2*t)+(A/2)*sin(2*pi*ff*7*t)... % fundamental+2nd+7th harmonic
+(A/2)*sin(2*pi*ff*13*t)+sd*randn(1,N); % + 13th harmonic + noise
plot(t,x,'-r.', t, xf,'-g.');
grid on; xlabel('Time (s)'); ylabel('Amplitude')
The total signal and the fundamental frequency sinusoid are plotted.
[b,a]=butter(2,.1); % Butterworth lowpass filter, 2 pole, normalized cutoff frequency=0.1
y=filtfilt(b,a,x); % filter the signal
hold on; plot(t,y,'-b.'); % add filtered signal to plot
legend('Total Signal','Fundamental Sinusoid','Filtered Signal')
The blue trace is the filtered signal. We hope that it will look like the green signal. The last cycle of the filtered signal is weird, due to edge effects, but the preceding cycles are pretty similar to the green trace. Not perfect but not terrible.
Try changing the filter order (from 2 to 3-8) and the cutoff frequency (from 0.1 to a number between 0 and 1) in the line
[b,a]=butter(2,.1);
and see if you like the results better than the results above.

カテゴリ

Help Center および File ExchangeFilter Analysis についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by