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!