Below are three different codes in Matlab, please copy those your matlab and answer the following questions:
Thank you for your help!!!!
1.1 Baseband Signal
a) Plot time versus baseband signal (m_sig).
b) Plot freq versus baseband signal spectrum (M_fre).
1.2 Amplitude Modulation – Suppressed Carrier.
a) Plot time versus the DSB-SC signal (s_dsb).
b) Plot freq versus the DSB-SC signal spectrum (S_dsb).
1.3 Coherent Demodulation
a) Plot freq versus the pre-filtered signal (S_dem).
b) Plot freq versus the post-filtered signal (S_rec).
c) Plot time versus the demodulated signal (s_rec).
Note: to generate S_dem and S_rec, you’ll have to go through the same process as was shown in Part 1.2 for S_dsb.
1.4 Amplitude Modulation – with Carrier
a) Plot time versus the DSB-wC signal (s_am).
b) Plot freq versus the DSB-wC signal spectrum (S_am).
1.5 Rectifier Demodulator
a) Plot time versus the rectified signal (s_dem).
b) Plot time versus the received signal (s_rec).
1.6 AM Questions
a) What is the modulation index of the AM signal in Part 1.4?
b) Could you set the modulation index to 0.5 and successfully demodulate this signal with an envelope detector? Could you set it to 1.5? Why or why not?
c) How is the envelope detector different from the coherent filter? What would happen, if you demodulated the AM-sC signal with an envelope detector?
%%%%%%%%%%%%%%%%%%%%%%%%%%
MATLAB CODE 1
% This program uses triangl.m to illustrate DSB modulation and demodulation
ts = 1.e-4;
t = -0.04:ts:0.04;
Ta = 0.01;
m_sig = triangl((t+0.01)/0.01) - triangl((t-0.01)/0.01);
Lm_sig = length(m_sig);
Lfft = length(t);
Lfft = 2^ceil(log2(Lfft));
M_fre = fftshift(fft(m_sig,Lfft));
freqm = (-Lfft/2:Lfft/2-1)/(Lfft*ts);
B_m = 150; %Bandwidth of the signal is B_m Hz
h =fir1(40,[B_m*ts]);
fc = 300;
s_dsb = m_sig.*cos(2*pi*fc*t);
%Lfft = 2^ceil(log2(Lfft)+1);
S_dsb = fftshift(fft(s_dsb,Lfft));
freqs = (-Lfft/2:Lfft/2-1)/(Lfft*ts);
% Demodulation begins by multiplying with the carrier
s_dem = s_dsb.*cos(2*pi*fc*t)*2;
S_dem = fftshift(fft(s_dem,Lfft));
% Using a adeal LPF with bandwidth 150 Hz
s_rec = filter(h,1,s_dem);
S_rec = fftshift(fft(s_rec,Lfft));
Trange = [-0.025 0.025 -2 2];
figure(1);
subplot(221);
td1 = plot(t,m_sig);
axis(Trange);
set(td1,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it m} ({\it t})');
title('message signal');
subplot(222);
td2 = plot(t,s_dsb);
axis(Trange);
set(td2,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it s}_({\rm DSB} ({\it t})');
title('DSB-SC modulated signal');
subplot(223);
td3 = plot(t,s_dem);
axis(Trange);
set(td3,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it e} ({\it t})');
title('{\it e} ({\it t})');
subplot(224);
td4 = plot(t,s_rec);
axis(Trange);
set(td4,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it m}_d({\it t})');
title('Recovered Signal');
Frange = [-700 700 0 200];
figure(2)
subplot(221);
fd1 = plot(freqm,abs(M_fre));
axis(Frange);
set(fd1,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it M} ({\it f})');
title('message spectrum');
subplot(222);
fd2 = plot(freqs,abs(S_dsb));
axis(Frange);
set(fd2,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it S}_{rm dsb} ({\it f})');
title('DSB-SC spectrum');
subplot(223);
fd3 = plot(freqs,abs(S_dem));
axis(Frange);
set(fd3,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it E} ({\it f})');
title('spectrum of {\it e} ({\it t})');
subplot(224);
fd4 = plot(freqs,abs(S_rec));
axis(Frange);
set(fd4,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it M}_d({\it f})');
title('Recovered spectrum');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MATLAB CODE 2
ts = 1.e-4;
t = -0.04:ts:0.04;
Ta = 0.01;
m_sig = triangl((t+0.01)/0.01) - triangl((t-0.01)/0.01);
Lm_sig = length(m_sig);
Lfft = length(t);
Lfft = 2^ceil(log2(Lfft));
M_fre = fftshift(fft(m_sig,Lfft));
freqm = (-Lfft/2:Lfft/2-1)/(Lfft*ts);
B_m = 150; %Bandwidth of the signal is B_m Hz
h =fir1(40,[B_m*ts]);
% AM signal generated by adding a carrier to DSB-SC
s_am = (1+m_sig).*cos(2*pi*fc*t);
S_am = fftshift(fft(s_am,Lfft));
freqs = (-Lfft/2:Lfft/2-1)/(Lfft*ts);
% Demodulation begins by using a rectifier
s_dem = s_am.*(s_am>0);
S_dem = fftshift(fft(s_dem,Lfft));
% Using an ieal LPF with bandwidth 150 Hz
s_rec = filter(h,1,s_dem);
S_rec = fftshift(fft(s_rec,Lfft));
Trange = [-0.025 0.025 -2 2];
figure(1);
subplot(221);
td1 = plot(t,m_sig);
axis(Trange);
set(td1,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it m} ({\it t})');
title('Message signal');
subplot(222);
td2 = plot(t,s_am);
axis(Trange);
set(td2,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it s}_({\rm DSB} ({\it t})');
title('AM modulated signal');
subplot(223);
td3 = plot(t,s_dem);
axis(Trange);
set(td3,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it e} ({\it t})');
title('Rectified signal without local carrier');
subplot(224);
td4 = plot(t,s_rec);
axis(Trange);
set(td4,'Linewidth',1.5);
xlabel('{\it t} (sec)');
ylabel('{\it m}_d({\it t})');
title('Detected Signal');
Frange = [-700 700 0 200];
figure(2)
subplot(221);
fd1 = plot(freqm,abs(M_fre));
axis(Frange);
set(fd1,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it M} ({\it f})');
title('message spectrum');
subplot(222);
fd2 = plot(freqs,abs(S_am));
axis(Frange);
set(fd2,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it S}_{rm dsb} ({\it f})');
title('AM spectrum');
subplot(223);
fd3 = plot(freqs,abs(S_dem));
axis(Frange);
set(fd3,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it E} ({\it f})');
title('Rectified spectrum');
subplot(224);
fd4 = plot(freqs,abs(S_rec));
axis(Frange);
set(fd4,'Linewidth',1.5);
xlabel('{\it f} (Hz)');
ylabel('{\it M}_d({\it f})');
title('Recovered spectrum');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MATLAB code 3
% Triangle Function
%
function y=triangl(t)
y= (1-abs(t)).*(t>=-1).*(t<1);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
a)
in the given code
s_am = (1+m_sig).*cos(2*pi*fc*t);
therefore, the modulation index is max(m_sig)=1
therefore modulation index is 1
b)
It is possible to set modulation index to 0.5 and demodulate the signal,and
NOT possible to set modulation index to 1.5 and demodulate the signal with an envelope detector.
When modulation index is less than 1, the term (1+k*m_sig), (where k is modulation index (for the present case)) is always positive
i.e (1+k*m_sig)>=0
but when k>1, (1+k*m_sig)<0, making it negative, in which case there will be phase cross over. Essentially k>1 does not preserve the amplitude of modulated signal as message signal. In such a case its not possible to demodulate using envelope detection.
c)
Coherent detection is a linear detection meaning that demodulator is a linear system, but envelope detection is non-linear as it uses diode rectification.
For envelope detection, when a signal x(t)=x1(t)*c(t) (where c(t) is carrier) is fed to the envelope detector, it is necessary that x1(t)>0 for all times, else there will be problem of phase cross over and the demodulation is not possible.
For the case of DSB-C(conventional AM), x1(t)=1+k*m(t) >=0, for |k*m(t)|<1, which satisfies the condtion.
For DSB-SC case, x1(t)=m(t), therefore x1(t)>0 is not true for all the time, and for times m(t)<0, there will be phase cross over distortion, and the demodulated out put for such times is not the near replica of the message signal.
Get Answers For Free
Most questions answered within 1 hours.