How can i design an digital FM demodulator using zero crossing detector in MATLAB?.

How can i design an digital FM demodulator using zero crossing detector in MATLAB?.
I have already created an FM modulated signal,digitized it using a 12 bit ADC.Then i gave it to a limiter,differentiator.Now i have a train of pulses which indicate positive zero crossings.how i can recover original message signal?.I tried using a monoshot as per theory.but it is actually not working.
my code as follows:
clc; clear all; close all; fm=15000000; kf=5; fc =434e6; Fs = fc*8; % Sampling rate is 120 MHz. t = 0:1/Fs:.000001; u1=sin(30000000*pi*t); subplot(3,1,1),plot(u1);axis([0 1000 -2 2]); title('msg signal'); u2=sin(2*434000000*pi*t); figure(1); subplot(3,1,2),plot(u2);axis([0 1000 -2 2]); title('carrier '); m=cos(2*pi*fc*t+kf*u1); subplot(3,1,3); plot(m);axis([0 500 -5 5]);
n=length(m); Tm=zeros(1,length(u1)); digitized=zeros(1,n); m=cos(2*pi*fc*t+kf*u1); figure(2); % Representation of the signal subplot(4,1,1),plot(m); title('fmmodulated signal '); axis([0 500 -5 5]) fid1 = fopen('bin1.vec','wb'); for j=1:n for i=0:2047 if (0.00048828125*i)<=m(j)&& m(j)<=(0.00048828125*(i+1)) output1=dec2bin(i,12); digitized(j)=i; fprintf(fid1,output1); fprintf(fid1,'\n'); end; if ((-1+(0.00048828125*i))<=m(j) && m(j)<(-1+(0.00048828125*(i+1)))) output1=dec2bin(2048+i,12); digitized(j)=-(2048-i); fprintf(fid1,output1); fprintf(fid1,'\n'); end; end; end;
fclose(fid1); subplot(4,1,2),plot(digitized),title('digitized');axis([0 500 -150 150])
t = 0:1/Fs:.000001; % time vector
% zercrx=[];
% for i=1:length(digitized)-1
% if ((digitized(i)>0 && digitized(i+1)<0) || (digitized(i)<0 && digitized(i+1)>0))
% zercrx(end+1)=i; % save zero-crossing points
% y(i)=1;
% end
% end
% t(zercrx); % display time points of zero-crossings
%
% subplot(4,1,3);plot(y);title('zero cross detection');axis([0 500 -5 5]);
% FM demodulation digitized(digitized<=0)=-1; %limiter digitized(digitized>0)=+1; figure;plot(digitized);title('signal after limiting');axis([0 500 -5 5]); digitized(2:length(digitized))=diff(digitized); figure;plot(digitized);title('signal after differentiator');axis([0 500 -5 5]); digitized(digitized<0)=0; figure;plot(digitized);title('signal indicating positive zero crossings');axis([0 500 -5 5]);
%#$###############monostable multivibrator#########################
dt=1/(fm*200); Tm=zeros(1,length(u1));
Tm=1./(fc+kf*u1(i)); mmv=round(Tm/dt);
for(i=1:length(digitized)) if(digitized(i)>0) for(j=i:(i+mmv-1)); digitized(j)=1; % advance index to last index of mmv pulse end; i=i+mmv-1; end; end;
figure;plot(digitized);title('output of mmv');axis([0 500 -5 5]);

Answers (0)

Asked:

on 18 Jan 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!