MATLAB code for Amplitude modulation (AM) with modulation index

How to generate Amplitude modulation (AM) using MATLAB? AM is a method of transmitting signals, such as sound or digital information, in which the amplitude of carrier wave is changed according to the message signal. AM is widely used in electronic communication field. The plotting of AM signal using MATLAB is very easy.
Here we are simply adding the carrier amplitude with message signal to obtain AM signal, then the instantaneous amplitude of carrier gets altered with respect to modulating signal. Thus the carrier amplitude varies according to the base band signal (message signal). The MATLAB code is shown below, the uses of particular code is also given in commented form (%Comment field). The program is capable of accepting two input frequencies and modulation index from the keyboard.

Mathematical representation of AM Signal

If the message signal is represented by,
 and carrier signal by,
Then the equation of amplitude modulation is given by,
Where ‘mi’ is the modulation index and ‘A’ is the amplitude

MATLAB Codes

clc;
clear all;
close all;
t=0:0.001:1;
set(0,'defaultlinelinewidth',2);
A=5;%Amplitude of signal
fm=input('Message frequency=');%Accepting input value
fc=input('Carrier frequency=');%Accepting input value (f2>f1)
mi=input('Modulation Index=');%Modulation Index

Sm=A*sin(2*pi*fm*t);%Message Signal
subplot(3,1,1);%Plotting frame divided in to 3 rows and this fig appear at 1st
plot(t,Sm);
xlabel('Time');
ylabel('Amplitude');
title('Message Signal');
grid on;

Sc=A*sin(2*pi*fc*t);%Carrier Signal
subplot(3,1,2);
plot(t,Sc);
xlabel('Time');
ylabel('Amplitude');
title('Carrier Signal');
grid on;

Sfm=(A+mi*Sm).*sin(2*pi*fc*t);%AM Signal, Amplitude of Carrier changes to (A+Message)
subplot(3,1,3);
plot(t,Sfm);
xlabel('Time');
ylabel('Amplitude');
title('AM Signal');
grid on;

Generated AM Signal

Ads


0 comments:

Post a Comment

 

Copyright © 2011 CircuitsGallery| ToS | Privacy Policy |

Contact Us | Write For Us | Advertise on Circuits Gallery | About Us