MATLAB code for Frequency modulation (FM) with modulation index

How to generate frequency modulation (FM) in MATLAB? Before that we must know what is FM (frequency modulation). In FM, frequency of the carrier signal having high frequency is varied in accordance with the instantaneous amplitude of the modulating signal having low frequency. Frequency modulated signals are widely used in television and radio transmission systems. FM signals can be easily plotted using simple MATLAB functions. The MATLAB code is shown below, the use of particular code is also given as commented form ( %Comment field ). The given matlab program is capable of accepting two input frequencies and modulation index from the user.
Also see:

Mathematical representation of FM Signal

    Let the modulating signal be
     and the carrier signal be
                             
     then the modulating signal e(t) is expressed as
                   
                               where 'm' is the modulation index.

MATLAB Codes

clc;
clear all;
close all;

fm=input('Message Frequency=');

fc=input('Carrier Frequency=');

mi=input('Modulation Index=');

t=0:0.0001:0.1;

m=sin(2*pi*fm*t);

subplot(3,1,1);

plot(t,m);

xlabel('Time');

ylabel('Amplitude');
title('Message Signal');
grid on;

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

y=sin(2*pi*fc*t+(mi.*sin(2*pi*fm*t)));%Frequency changing w.r.t Message
subplot(3,1,3);
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
title('FM Signal');
grid on;

Generated FM Signal

Message Frequency=25
Carrier Frequency=400
Modulation Index=10

FM in Matlab

Hope this matlab program was helpful to you. Similarly you can find out the codes for ASK, PWM etc in this website. Also we will come up with more. So keep visiting and let us know your views through the comment boxes below.  
Ads


0 comments:

Post a Comment

 

Copyright © 2011 CircuitsGallery| ToS | Privacy Policy |

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