필터 지우기
필터 지우기

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 CenterFile Exchange에서 Filter Analysis에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by