To perform Frequency Modulation & Demodulation of a signal
Program:
%% Matlab code for FM encoder decoder
Fs = 8000; % Sampling rate of signal
Fc = 3000; % Carrier frequency
t = [0:Fs]/Fs; % Sampling times
s1 = sin(2*pi*10*t); % Channel 1
%s2 = sin(2*pi*150*t)+2*sin(2*pi*900*t); % Channel 2
%x = [s1]; % Two-channel signal
dev = 50; % Frequency deviation in modulated signal
y = fmmod(s1,Fc,Fs,dev); % Modulate both channels.
z = fmdemod(y,Fc,Fs,dev); % Demodulate both channels.
subplot(2,1,1); plot(t,y); title('frequency modulated image');% Plot x on top.
subplot(2,1,2); plot(t,z);title('demodulated image');% Plot y below.
No comments:
Post a Comment