Ammoddemodcode
Ammoddemodcode
01:100;
k=1;%KHz frequancy
wm=0.5*k;%massage frequancey
wc=1000*k;% carrier frequancey
Am=0.5;%massage amplitude volt
Ac=10;% carrier amplitude volt
%%%%%%% transmitter%%%%%%
massage=Am*cos(wm*t);
carrier=Ac*cos(wc*t);
AM_signal=[1+massage].*carrier
%%%%%%% channel%%%%%%%
tX_signal=AM_signal;
%%%%%%receiver%%%%%%
RX_signal = tX_signal.*carrier;
wn = .02; % PSD lowpass filter cut - off frequency
[b,a] = butter(2,wn); % Design lowpass filter
demod_signal = filter(b,a,RX_signal); % Apply lowpass filter
%%%%%%%%%%%%%%%
subplot(5,1,1)
plot(t,massage,'.')
grid on
title('massage signal')
xlabel('time')
ylabel('amplitude ')
subplot(5,1,2)
plot(t,carrier,'.')
grid on
title('carrier signal')
xlabel('time')
ylabel('amplitude ')
subplot(5,1,3)
plot(t,AM_signal,'.')
grid on
title('AM signal')
xlabel('time')
ylabel('amplitude ')
subplot(5,1,4)
plot(t,tX_signal,'.')
grid on
title('TX signal')
xlabel('time')
ylabel('amplitude ')
subplot(5,1,5)
plot(t,demod_signal,'.')
grid on
title('Demod signal')
xlabel('time')
ylabel('amplitude ')