100% found this document useful (1 vote)
780 views

FM & AM Matlab Codes

The document discusses mathematical representations and MATLAB code implementations of frequency modulation (FM) signals. It provides the equations to represent an FM signal given a modulating signal and carrier signal. It also includes MATLAB code to generate sample FM signals and plot the modulating signal, carrier signal, and FM signal. The code also demonstrates adding noise to the FM signal during transmission and demodulating the noisy signal.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
780 views

FM & AM Matlab Codes

The document discusses mathematical representations and MATLAB code implementations of frequency modulation (FM) signals. It provides the equations to represent an FM signal given a modulating signal and carrier signal. It also includes MATLAB code to generate sample FM signals and plot the modulating signal, carrier signal, and FM signal. The code also demonstrates adding noise to the FM signal during transmission and demodulating the noisy signal.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

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 ( Frequency Modulation) With Noise Programming MATLAB code


FM with noise

Fs = input('enter the value of Fs '); % Sampling rate of signal Fc = input('enter the value of Fc '); % Carrier frequency t = [0:Fs]'/Fs; % Sampling times x = sin(2*pi*20*t)%+2*sin(2*pi*60*t); % Channel dev = input('enter the value of dev ');% Frequency deviation in modulated signal y = fmmod(x,Fc,Fs,dev); % Modulate both channels. n = input('enter the value of snr '); n = awgn(x,30); z = fmdemod(y,Fc,Fs,dev); % Demodulate both channels. figure; subplot(3,1,1); plot(x); subplot(3,1,2); plot(y); subplot(3,1,3); plot(z);

Amplitude and Frequency Modulation MatLab Code


AMPLITUDE MODULATION: When fm =10 Hz and fc= 20Hz; DSB-SC: t=0:0.001:1; vd=8*cos(2*pi*5*t); vc=0.1*cos(2*pi*15*t); ft=vc.*vd; am=ft+vc; figure(1)

plot(t,vd); figure(2) plot(t,vc); figure(3) plot(t,am); FOR DSB-FC : vm=10 ; vc=5 ; fm=20 ; fc=100 ; t=0:0.0001:0.0999; f=1:1:999; wc=2*pi*fc; wm=2*pi*fm; V1=vc+vm*sin(wm*t); V2=-(vc+vm*sin(wm*t)); Vm=vm*sin(wm*t); Vc=vc*sin(wc*t); Vam=(1+sin(wm*t)).*(sin(wc*t)); Vf=abs(fft(Vam,10000))/10000; figure; plot(t,Vam); hold on; plot(t,V1,'r')

plot(t,V2,'r'); xlabel('frequency'), ylabel('amplitude'); grid on; %plotting modulating signal figure; plot(t,Vm); title('AM modulating signal'); xlabel('time'), ylabel('amplitude'); grid on; %Plot carrier signal figure; plot(t, Vc); title('AM carrier signal'); xlabel('time'), ylabel('amplitude'); grid on; clear; FM MODULATION: vc=1; vm=1; fm=250; fc=5000; m=10; t=0:0.00001:0.09999;

f=0:10:99990; wc=2*pi*fc; wm=2*pi*fm; sc_t=vc*cos(wc*t); sm_t=vm*cos(wm*t); kf=1000; s_fm=vc*cos((wc*t)+10*sin(wm*t)); vf=abs(fft(s_fm,10^4))/5000; figure; plot(t,s_fm); hold on; plot(t,sm_t,'r'); axis([0 0.01 -1.5 1.5]); xlabel('time(second)'),ylabel('amplitude'); title('FM time-domain'); grid on; figure; plot(f,vf); axis([ 0 10^4 0 0.4]); xlabel('frequency'),ylabel('amplitude'); title('FM frequency-domain'); grid on;figure;plot(t,sm_t); axis([0 0.1 -1.5 1.5]); title('FM modulating signal');

You might also like