# AM Generation using Matlab

## AM Generation using Matlab

Amplitude modulation (AM) is a one of the conventional modulation technique to transmit signals using a carrier wave. The amplitude or the strength of a high frequency carrier wave is changed in accordance with the amplitude of message signal. Generation of AM in MATLAB is a piece of cake. If you are new to MATLAB, please go through ourÂ tutorials.

First of all lets get into the basics..

• Carrier signal (Sc) = Acsin(2Ď€fct)
• Message signal (Sm)Â =Â Amsin(2Ď€fmt)

Where,

• Ac – Amplitude of the carrier signal
• Am – Amplitude of the message signal
• fc – frequency of the carrier signal
• fm – frequency of the message signal

When the signal is amplitude modulated, the amplitude of the high frequency carrier is varied in accordance with the amplitude of message signal.

• Modulated Signal =Â (Ac+ Amsin(2 Ď€fmt))*sin(2 Ď€fct)

Modulation IndexÂ or Modulation Depth is the one of the most common term that used along with modulation techniques. Here in AM, it is the measure of amplitude variation surrounding an unmodulated carrier. It is the ratio of the amplitude of message signal to the amplitude of carrier signal.

In terms of modulation index (m=Am/Ac) the equation of the modulated signal becomes,

• Modulated signal = (1+ msin(2 Ď€fmt))*Acsin(2 Ď€fct)Â

Now you can easily understand the following code.

# Matlab Code

```Ac=input('enter carrier signal amplitude');
Am=input('enter message signal amplitude');
fc=input('enter carrier frequency');
fm=input('enter message frequency');% fm<fc
m=input('enter modulation index');
t=input('enter time period');
t1=linspace(0,t,1000);
y1=sin(2*pi*fm*t1); % message signal
y2=sin(2*pi*fc*t1); % carrier signal
eq=(1+m.*y1).*(Ac.*y2);
subplot(311);
plot(t1,y1);
xlabel('Time');
ylabel('Amplitude');
title('Message signal')
subplot(312)
plot(t1,y2);
xlabel('Time');
ylabel('Amplitude');
title('Carrier signal');
subplot(313);
plot(t1,eq);
plot(t1,eq,'r');
xlabel('Time');
ylabel('Amplitude');
title('Modulated signal');```

# Output

AM Generation using Matlab

• u12ec017

nice work

February 18, 2014 at 5:01 pm
• Rabson Mashiri

hi guys, ‘am a student in Electronic eng. and currently doing a project entitled Microcontroller based automatic power factor controlling system as part of fulfillment of my studies. So i need ideas as to how can i come up with the circuit diagram and the code in c#

March 20, 2014 at 8:22 pm
• Ritesh Dumpala

@Manoj Shenoy Thank you so much for posting this. I am working on a project for my subject and have forgotten all my basics. This code will really help me for good. Thanks again. Great work đź™‚

October 8, 2015 at 1:26 am
• amani

sorry i have to do a AM in simulink matlab , and i don’t get the good resolution?? i have to do it by un source signal at NRZ code withe a sin signale ??? can any one help me plz !!

October 26, 2016 at 3:59 am
• Sajib

Hello..
Wondering if u have made a mistake while deriving the main equation. Also, what is the use of the AM(Amplitude Message) Input, if that wasn’t ever used in the code?

February 16, 2017 at 3:34 am