Low pass filter for amplitude modulation

I was writting a code of AM DSBSC .
Here is the ouput graph
  1. Information signal
  2. Carrier*information signal
  3. demodulated signal
Now the demodulated signal needs to be passed through a low pass filter .I was using the lowpass function but I am not getting the ouput I need.Th output should be the red graph.
Please tell me where I am wrong?
Thank you.
here is my code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t=0:1e-4:0.5;
f=5;
y=sin(2*pi*f*t);
subplot(3,1,1)
plot(t,y)
hold on
yline(0)
xline(0.2)
ylim([-2 2])
hold off
subplot(3,1,2)
y1=sin(2*pi*100*t);
y3=y1.*y;
plot(t,y3)
hold on
yline(0)
hold off
subplot(3,1,3)
y4=y3.*sin(2*pi*100*t);
y5=lowpass(y4,1,1e4)
plot(t,y5)
hold on
ylim([-2 2])
plot(t,y);
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Respuestas (1)

Mathieu NOE
Mathieu NOE el 19 de Oct. de 2020
hi
my suggestion below (tested OK)
dt = 1e-4;
Fs = 1/dt;
t=0:dt:0.5;
f=5;
y=sin(2*pi*f*t);
subplot(3,1,1)
plot(t,y)
hold on
yline(0)
xline(0.2)
ylim([-2 2])
hold off
subplot(3,1,2)
y1=sin(2*pi*100*t);
y3=y1.*y;
plot(t,y3)
hold on
yline(0)
hold off
subplot(3,1,3)
y4=y3.*sin(2*pi*100*t);
[BlpFilt,AlpFilt] = butter(4,0.01);
y5 =filter(BlpFilt,AlpFilt,y4);
plot(t,y5,'r')
hold on
ylim([-2 2])
plot(t,y);
hold off

2 comentarios

Newton Nadar
Newton Nadar el 20 de Oct. de 2020
Editada: Newton Nadar el 20 de Oct. de 2020
Demodulated signal is still not same?
hello
because for y5 we used the function "filter" so the demodulated signal is phase shifted from the original signal (y)
to avoid this phase shift I replaced "filter" with "filtfilt" so no more phase shift
also I increased the amplitude of the y5 signal so that now both traces superposed well.
see pictures attached
new code below :
clc
close all
dt = 1e-4;
Fs = 1/dt;
t=0:dt:0.5;
f=5;
y=sin(2*pi*f*t);
subplot(3,1,1)
plot(t,y)
hold on
yline(0)
xline(0.2)
ylim([-2 2])
hold off
subplot(3,1,2)
y1=sin(2*pi*100*t);
y3=y1.*y;
plot(t,y3)
hold on
yline(0)
hold off
subplot(3,1,3)
y4=y3.*sin(2*pi*100*t);
% y5=lowpass(y4,1,1e4)
[BlpFilt,AlpFilt] = butter(4,0.01);
% y5 =filter(BlpFilt,AlpFilt,y4);
y5 =filtfilt(BlpFilt,AlpFilt,y4);
plot(t,2*y5,'-*r')
hold on
ylim([-2 2])
plot(t,y);
hold off

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2020b

Preguntada:

el 18 de Oct. de 2020

Comentada:

el 20 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by