Low pass filter for amplitude modulation
이전 댓글 표시
I was writting a code of AM DSBSC .
Here is the ouput graph

- Information signal
- Carrier*information signal
- 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
답변 (1개)
Mathieu NOE
2020년 10월 19일
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
Newton Nadar
2020년 10월 20일
편집: Newton Nadar
2020년 10월 20일
Mathieu NOE
2020년 10월 20일
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
카테고리
도움말 센터 및 File Exchange에서 Antennas, Microphones, and Sonar Transducers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!