Question

In: Electrical Engineering

I need a matlab code for my presentation. Code should include Single Sideband Amplitude Modulation and...

I need a matlab code for my presentation. Code should include Single Sideband Amplitude Modulation and Demodulation. It should figure 3 things:

-time domain of given message signal in Amplitude Modulation and Single Sideband Amplitude Modulation

-frequency domain of given signal in Amplitude Modulation and Single Sideband Amplitude Modulation

-And it should demodulate and show message signal.

Solutions

Expert Solution

Matlab code:

fs=10000;%sampling frequency
Ts=1/fs;%sampling period
N=1000;%number of samples
t=[0:Ts:N*Ts-Ts];%time axis
f=[-fs/2:fs/N:fs/2-fs/N];%frequency axis
fc=2000;%carrier frequency
fm=300;%modulation frequency
A=5;
m=0.5;%modulation index
Sc=A*cos(2*pi*fc*t);
Sm=A*sin(2*pi*fm*t);
%Amplitude modulation
St=(A+m*Sm).*sin(2*pi*fc*t);
Yt=fft(St);%modulated signal DFT
figure(1)
subplot(3,1,1);plot(t,Sm);
subplot(3,1,2);plot(t,Sc);
subplot(3,1,3);plot(t,St);title('AM Signal');xlabel('Time axis');ylabel('Amplitude');
figure(2)
stem(f,fftshift(abs(Yt))) ;title('AM Signal Spectrum');xlabel('Frequency axis');ylabel('Amplitude');

%%%%%%% ssb modulation%%%%%%%%%%%%%%%%
fm1 = 200;
fm2 = 100;
Em1 = 2;
Em2 = 2;

m = Em1*cos(2*pi*fm1*t)+Em2*cos(2*pi*fm2*t); %Message
mh = imag(hilbert(m)); %Hilbert transform of the message signal

sbu = m.*2.*cos(2*pi*fc*t) - mh.*2.*sin(2*pi*fc*t); %Expression for USB SSB
sbl = m.*2.*cos(2*pi*fc*t) + mh.*2.*sin(2*pi*fc*t); %Expression for LSB SSB
SBU = 2/N*abs(fft(sbu));
SBL = 2/N*abs(fft(sbl));

freq = fs * (0 : N/2) / N;

display('Single SideBand Modulation');
sprintf('Carrier frequency: %d Hz',fc)
sprintf('Message frequency: %d Hz and %d Hz',fm1,fm2)
sprintf('USB spectra at: %d Hz and %d Hz',fc+fm1,fc+fm2)
sprintf('LSB spectra at: %d Hz and %d Hz',fc-fm1,fc-fm2)

figure(3)
subplot(211);
plot(10*t(1:200),sbu(1:200),'b'); %Time Domain Plot
title('SSB Time Domain Representation');
xlabel('Time'); ylabel('Modulated Signal');

subplot(212);
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1)); %Frequency domain plot
title('SSB Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');
%
% %%% Demodulation %%%%
% figure()
% z1=ssbdemod(sbu,fc,fs);
% z2=ssbdemod(sbl,fc,fs);
% plot(t,z1,'k',t,z2,'g-.',t,Sm,'r');
%
% figure()
% z3=amdemod(St,fc,fs);
% plot(t,z3);

xc=Sc;
xm=Sm;
figure(4)
subplot(2,1,1),plot(t,xc);
title('carrier signal ');
xlabel('time (sec)');
ylabel('amplitude');
subplot(2,1,2),plot(t,xm);
title('message signal ');
xlabel('time (sec)');
ylabel('amplitude');
% DSB--SC MODULATION
z= xm.*xc;
figure(5)
subplot(2,1,1),plot(t,z);
title('DSB-SC MODULATION IN TIME DAOMAIN');
xlabel('time (sec)');
ylabel('amplitude');
l1=length(z);
f=linspace(-fs/2,fs/2,l1);
Z=fftshift(fft(z,l1)/l1);
subplot(2,1,2),plot(f,abs(Z));
title('DSB SC MODULATION IN FREQUENCY DOMAIN');
xlabel('frequency(hz)');
ylabel('amplitude');
% demodulation
s=z.*xc;
S=fftshift(fft(s,length(s))/length(s));
figure(6)
plot(f,abs(S));
title(' demodulated signal IN FREQUENCY DOMAIN before filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
hold on
rlp=1./sqrt(1+(f./fc).^(2*100));
plot(f,rlp,'g');
title(' frequency response of low pass filter');
xlabel('frequency(hz)');
ylabel('amplitude');

E=rlp.*S;
figure(7)
subplot(2,1,1),plot(f,E);
title(' Recover signal IN FREQUENCY DOMAIN after filtring');
xlabel('frequency(hz)');
ylabel('amplitude');
e=ifft(ifftshift(E))*length(E);
subplot(2,1,2),plot(t,(1/0.5)*e);
title(' Recover signal IN Time DOMAIN after filtring');
xlabel('time(sec)');
ylabel('amplitude');


Related Solutions

pls, I need Matlab code for, OFDM modulation (Matlab demo by at least 4 carriers)
pls, I need Matlab code for, OFDM modulation (Matlab demo by at least 4 carriers)
Hi, I need a Matlab code satisfies the following question. Output should be a graph similar...
Hi, I need a Matlab code satisfies the following question. Output should be a graph similar to a sine or cosine graph or similar to electrocardiograms (EKG/ECG) graph. Please I'd appreciate it. All love. Thanks :) In elementary quantum mechanics, the square well is used to model the behavior of a bound particle, in which one or more forces (external potentials, interaction with other particles, etc) prevent or restrict its ability to move about. We have seen in class that...
i need matlab code of heat equation in 1D with convection ?
i need matlab code of heat equation in 1D with convection ?
this is my Matlab code for lemur and plant population simulation. But i didn't get the...
this is my Matlab code for lemur and plant population simulation. But i didn't get the right graph. R(1,1)=35; % Initial pop of males R(2,1)=35; % Initial pop of females P(3,1)=200000; % Iniitial pop of plants r(1)=1.01; % Growth rate of male pop r(2)=1.01; % Growth rate of female pop r(3)=1.10; % Growth rate of plants K(1)=800; % Carrying capacity for male pop K(2)=600; % carrying capacity for female pop K(3)=7500000; % carrying capacity for plants    E=65; % Plants...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft and dft. Applied to discrete signals. If you can with an example.Thank you!!
Use the Matlab code discussed in class to build a simulator for the digital modulation scheme...
Use the Matlab code discussed in class to build a simulator for the digital modulation scheme PPM Coherent. Once finished, run the simulations required to plot BER curves with a minimum probability of bit-error of 10. 1. Plots: a. ??? vs ??? (??) plot – in the same graph, plot at least 4 BER curves corresponding to different values of symbol periods and pulse widths. b. Transmitted signal plot – plot the transmitted signal corresponding to 3 bits. c. Received...
Use the Matlab code discussed in class to build a simulator for the digital modulation scheme...
Use the Matlab code discussed in class to build a simulator for the digital modulation scheme PPM Coherent. Once finished, run the simulations required to plot BER curves with a minimum probability of bit-error of 10. 1. Plots: a. ??? vs ??? (??) plot – in the same graph, plot at least 4 BER curves corresponding to different values of symbol periods and pulse widths. b. Transmitted signal plot – plot the transmitted signal corresponding to 3 bits. c. Received...
I need a working MATLAB CODE for the Gram Schimdt process Please give the code fast...
I need a working MATLAB CODE for the Gram Schimdt process Please give the code fast Its urgent The code must run on any matrix given It should be a generic code Dont answer any wrong code or else i will badly dislike
I need an original matlab code and gui for a simple double pendulum. This needs to...
I need an original matlab code and gui for a simple double pendulum. This needs to be original and not too complicated. Please provide basic instructions. Thank you!
Explain mathemetically and with diagrams, what is single sideband amplitude modulation? kindly Answer ASAP. Ill give...
Explain mathemetically and with diagrams, what is single sideband amplitude modulation? kindly Answer ASAP. Ill give u upvote
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT