Azzera filtri
Azzera filtri

somethings wrong with LPF filter?

1 visualizzazione (ultimi 30 giorni)
Ngoc Lam
Ngoc Lam il 30 Nov 2014
Risposto: Ngoc Lam il 2 Dic 2014
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

Risposte (2)

Ngoc Lam
Ngoc Lam il 2 Dic 2014
with these picture was specified below: 1. the origin sine wave
2. the signal after multiplying
3. the signal after filtering

Ngoc Lam
Ngoc Lam il 2 Dic 2014
as you can see, the filter does not effect to the signal after multiplying, anyone can help me? thanks

Community Treasure Hunt

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

Start Hunting!

Translated by