In: Electrical Engineering
DSB:
Write the code for an m-file (script) to generate a DSB signal. The modulating (message) signal is a single tone signal with frequency 1kHz and the carrier frequency is 30kHz. Time Vector: 3001 points over range from 0 to 3ms (3 cycles of the modulating signal). Plot your original message signal both in time and its spectrum. (Note: use the cosine functions for your signals). In your report you should include the plots for the modulated signal in time and for the spectrum of the modulated signal.
AM:
For the same message signal and same carrier as in part a. write the code for an m-file to generate an AM signal. Do simulations for the following percentages of modulation: 1. 25% 2. 50% 3. 100% and 4.125%. In your report you should include the plots for the modulated signal in time and for the spectrum of the modulated signal for each of the 4 cases.
Discuss the results relative to the modulation index m.
SSB:
Use Matlab to implement a 4 pole-pair Butterworth band-pass filter to select the lower frequency component of the DSB modulated signal in part a. Plot the signal at the output of the filter in time and its spectrum.
Dear user,
Please find the Code attached.
Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear all;
close all;
%% Problem 1
fm=1e3;
fc=30e3;
t=0:1/1e6:3e-3;
m=1*cos(2*pi*fm.*t);
s=1*cos(2*pi*fc.*t);
subplot(2,1,1);
plot(t,m);title('Message Signal time domain');
subplot(2,1,2);
plot([0:length(m)-1]*1e6/length(m),abs(fft(m)));
title('Freq Domain');
%% Problem 1 DSB
modulated=m.*s; % DSB =m(t)*c(t)
figure(2)
subplot(2,1,1);
plot(t,modulated);title('Modulated Signal time domain');
subplot(2,1,2);
plot([0:length(modulated)-1]*1e6/length(modulated),abs(fft(modulated)));
title('Freq Domain');
%% Am=Ac(1+Ka*m(t))*cos(2*pi*fc*t) AM
%% Problem 2
per_modu=[0.0125 0.5 1 0.04125];
for i=1:length(per_modu)
am(i,:)=(1+(per_modu(i).*m)).*s; %AM =
Ac(1+Ka*Am*cos(2*pi*fm*t))*cos(2*i*fc*t)
end
figure(3)
subplot(4,2,1)
plot(t,am(1,:));title('Time domain % of modulation=1.25');
subplot(4,2,2)
plot([0:length(modulated)-1]*1e6/length(modulated),abs(fft(am(1,:))));
title('Freq domain for same');
subplot(4,2,3)
plot(t,am(2,:));title('Time domain % of modulation=50');
subplot(4,2,4)
plot([0:length(modulated)-1]*1e6/length(modulated),abs(fft(am(2,:))));
title('Freq domain for same');
subplot(4,2,5)
plot(t,am(3,:));title('Time domain % of modulation=100');
subplot(4,2,6)
plot([0:length(modulated)-1]*1e6/length(modulated),abs(fft(am(3,:))));
title('Freq domain for same');
subplot(4,2,7)
plot(t,am(4,:));title('Time domain % of modulation=4.125');
subplot(4,2,8)
plot([0:length(modulated)-1]*1e6/length(modulated),abs(fft(am(4,:))));
title('Freq domain for same');
%% Butter Worth Filter Design
%% Allowing Freq= 29KHz
fc=[28.995e3 29.005e3];
fs=1e6;
[b,a]=butter(2,fc./[fs/2],'bandpass'); %design butter worth filter
here
%figure(4)
%freqz(b,a);
%title('Butter worth Filter');
%% SSB reception
out=filter(b,a,modulated);
figure
subplot(2,1,1)
plot(t,out);
title('Time domain');
subplot(2,1,2)
plot([0:length(m)-1]*1e6/length(m),abs(fft(out)));
title('Freq Domain');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Outputs:
From figure (3) for various modulation index, we can see that the AM wave gets distorted in the frequency spectrum this can be seen in the form of phase reversal occuring for 100% modulation index which is undesirable.
thus we maintain modulation index <1 to have good reception as we can see from plots 0.125 and 0.4125 .
For the fourth figure, please note that we need to receive 29KHz signal from DSB and in frequency domain it is shown by zooming and placing cursor on the peak i.e 2.899e4=29KHz.
Thus we have obtained as expected.
Please let me know if you have any doubts
ThankYou.