% MATLAB Script for Amplitude Modulation
% Although it is possible to modulate any signal over a sinusoid, however I
% will use a low frequency sinusoid to modulate a high frequency sinusoid
% without the loss of generality.
format long;
% Clear all previuosly used variables and close all figures
clear all;
close all;
% Amplitude, Frequency and Phase Shift for Modulating Signal
A1 = 2; f1 = 5; p1 = 0;
% Amplitude, Frequency and Phase Shift for Carrier Signal
A2 = 4; f2 = 20; p2 = 0;
% Sample Rate - This will define the resolution
fs = 1000;
% Time Line. Longer the signal, better will be the fft
t = 0: 1/fs : 1;
% Generate the message signal
s1 = A1*sin(2*pi*f1*t + p1);
% Plot the message signal
figure(1);
plot(t,s1);
xlabel('Time (sec)');
ylabel('Amplitude');
title(['Message Signal with frequency = ',num2str(f1),' Hz']);
grid on;
% Generate the Carrier wave
s2 = A2*sin(2*pi*f2*t + p2);
% Plot the carrier wave
figure(2);
plot(t,s2);
xlabel('Time (sec)');
ylabel('Amplitude');
title(['Carrier Signal with frequency = ',num2str(f2),' Hz']);
grid on;
% Finally the Modulation
% Ref. Modern Analogue and Digital Communication Systems - B. P. Lathi
% Amplitude Modulation with Suppressed Carrier
% Double Sideband with Suppressed Carrier (DSB-SC)
s3 = s1.*s2;
% Generate the Envelope
s3_01 = A1*A2*(sin(2*pi*f1*t));
s3_02 = -A1*A2*(sin(2*pi*f1*t));
% Amplitude Modulation with Large Carrier
% Double Sideband with Large Carrier (DSB - LC)
s4 = (A2 + s1).*sin(2*pi*f2*t);
% Generate the Envelope
s4_01 = A2 + s1;
s4_02 = -A2 - s1;
% ----------------------------------------------------------
% Let's Check out the frequency content of the two Modulations
% Number of FFT points. N should be greater than Carrier Frequency
% Larger the better
N = 2^nextpow2(length(t));
f = fs * (0 : N/2) / N;
% Find FFT
s3_f = (2/N)*abs(fft(s3,N));
s4_f = (2/N)*abs(fft(s4,N));
%-------------------------------------------------------------
% Plot the two Modulations
% Plot the DSB-SC Signal
figure(3);
subplot(2,1,1);
plot(t,s3);
hold on;
plot(t,s3_01,'r');
hold on;
plot(t,s3_02,'g');
xlabel('Time (sec)');
ylabel('Amplitude');
title('Double Sideband with Suppressed Carrier');
grid on;
subplot(2,1,2);
plot(f(1:100),s3_f(1:100));
xlabel('Frequency (Hz)');
ylabel('| Amplitude |');
title('Spectral Anaalysis (Single Sided PSD)');
grid on;
% Plot the DSB-LC Signal
figure(4);
subplot(2,1,1);
plot(t,s4);
hold on;
plot(t,s4_01,'r');
hold on;
plot(t,s4_02,'g');
xlabel('Time (sec)');
ylabel('Amplitude');
title('Double Sideband with Large Carrier');
grid on;
subplot(2,1,2);
plot(f(1:100),s4_f(1:100));
xlabel('Frequency (Hz)');
ylabel('| Amplitude |');
title('Spectral Anaalysis (Single Sided PSD)');
grid on;
What's up, its nice paragraph concerning media print, we all know media is a impressive source of information.
ReplyDeletemy blog post - best bucket trucks
Also visit my web site :: locate a bucket truck
I ωοuld liκe to thank you fоr the effoгts уou've put in writing this blog. I'm hοping to check out the same hіgh-grade blog рostѕ frоm you later on as wеll.
ReplyDeleteΙn fact, your crеativе writing abilities hаs motiѵatеd me to gеt my own, personal
website now ;)
Also visit mу web page cheap auto insurance dallas
my site :: dallas auto insurance company
Paragraph writіng is also a exсitement, if you be familiaг wіth аfter that yοu can wгite if not it iѕ ԁifficult tо write.
ReplyDeletemy web ρаge: irving taxi company
My webpage > Irving taxi
Тhis iѕ a topіс ωhiсh
ReplyDeleteіs near to mу heaгt... Take caгe! Where are your contaсt details though?
Check out my blog - make money buying and selling cars
What's up to all, how is all, I think every one is getting more from this web page, and your views are nice in favor of new viewers.
ReplyDeletemy blog; best dallas seo company