# Amplitude Modulation MATLAB Programming Code

Here is the coding for the Amplitude modulation for the matlab programming. We assume that you already know the basics. However for this time, I am explaining some of the terms used above.

Fs denotes Sampling frequency.
Fc Denotes Carrier Frequency.
t is time.
x and y are the axis.
Y= ammod(x,fc,fs) is the code for ammod.

Fs = 8000;
fs1= 2000;
fs2= 10000;
Fc = 300;
fc1= 200;
fc2= 800;
t = [0:.1*Fs]’/Fs;
t1= [0:.2*fs1]’/fs1;
t2= [0:.5*fs2]’/fs2;
x = sin(20*pi*t);
x1= sin(20*pi*t1);
x2= sin(20*pi*t2);
y = ammod(x,Fc,Fs);
y1=ammod(x1,fc1,fs1);
y2=ammod(x2,fc2,fs2);
figure;
subplot(6,1,1);plot(t,x);
title(‘comparison of different amplitude modulation on different sampling frequency’)
subplot(6,1,2);plot(t,y);
subplot(6,1,3);plot(t1,x1);
subplot(6,1,4);plot(t1,y1);
subplot(6,1,5);plot(t2,x2);
subplot(6,1,6);plot(t2,y2);

Here is the graph that will look like this:

If there is any error let me know in comments and if you found the solutions please do tell so.