# FM ( Frequency Modulation) With Noise Programming MATLAB code

Here is the code for the frequency modulation (FM) with noise 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);

You can change the values, names and descriptions. Remove the descriptions as we normally don’t write them. They are their only for the understanding of the students. Once you understand them there is no need to write them.