somethings wrong with LPF filter?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all, I want to simulate a LPF Filter with parameters: fc=5Khz,Fs=20.5Khz, N =30, Hamming window.
so I initialized a sine wave with fcarrrier = 20Khz, each sine wave was initialized with 200 sample. then it was multiplied by itself! following this code below:
% code
M=200; % the number of sample of sine periodic
fcarrier=1e4;
T=128/fcarrier; % time to transmit sine wave
P=128; % the number of sine wave initialized!
t=0: T/M/P: T-T/M/P;
fs=length(t)/(T-T/M/P);
df=1/(T-T/M/P);
f=-fs/2:df:fs/2-df;
s=sin(2*pi*fcarrier*t);
s1=s.*s;
% fc=5Khz,fs= 20.5Khz, N=30,Hamming
Num=[-0.00142569822564206,0.00104684023675550,0.00257766825164500,-0.00197666192599148,-0.00613453687959036,0.00369061404220200,0.0132498601493775,-0.00590859914987426,-0.0257994044307132,0.00825012956971075,0.0481483043656084,-0.0103040044663240,-0.0961937471263727,0.0117048121269473,0.315044085886135,0.488060675152253,0.315044085886135,0.0117048121269473,-0.0961937471263727,-0.0103040044663240,0.0481483043656084,0.00825012956971075,-0.0257994044307132,-0.00590859914987426,0.0132498601493775,0.00369061404220200,-0.00613453687959036,-0.00197666192599148,0.00257766825164500,0.00104684023675550,-0.00142569822564206];
s2=filter(Num,1,s1);
figure(1)
subplot(2,1,1)
plot(s)
title('sine initialized');
subplot(2,1,2)
plot(f,abs(fftshift(fft(s))))
figure(2)
subplot(2,1,1)
plot(s1)
title('sine after mul');
subplot(2,1,2)
plot(f,abs(fftshift(fft(s1))))
figure(3)
subplot(2,1,1)
plot(s2)
title('sine after filtering')
subplot(2,1,2)
plot(f,abs(fftshift(fft(s2))))
the filter seem does not effect the sine wave, the spectrum of sine wave after filtering seem similar with sine wave after mul! Can anyone help me out! thanks
댓글 수: 0
답변 (2개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!