1. Generate FM signal and draw frequency domain waveform
%%generate FM signal and draw time domain waveform FM= -; %modulation signal frequency AM=0.5; %modulation signal Amplitude FC= 5e3; %Carrier Frequency AC=1; %Carrier Amplitude KF=10000*pi; %FM Sensitivity FS= 75e3; %Sample Rate N= the; %number of sample points T= (0: N-1)'/fs;% time Tm_t = Am*sin (2*PI*FM*T); %modulation signal phi_t= Kf*cumsum (m_t)/fs; %Phase Integral s_t= cos (2*pi*fc*t + phi_t); %modulated signal plot (T, s_t,'b'); %plot waveform Xlabel (' Time'); Xlim ('Auto'); Ylabel ('amplitude'); Ylim ('Auto');
2. Map the Spectrogram
Percent= length (s_t); %= Fftshift (FFT (s_t)); %= (0: L1)'*fs/l-1/2*fs;% horizontal axis-frequency figure(2 Plot the spectral map grid on; Xlabel ('frequency (Hz)'); Ylabel ('magnitude (DB)');
3. Bessel function values
The value of the Bessel function b= *n/fs;% Calculates the number of points in the frequency domain of 500Hz corresponding to c= *b+ +1; Calculates the corresponding position of FC in the frequency domain for i=0:1: A (i+1) =abs (U (c+ B*i)/n*2);% calculatesthe fc+i* FM corresponding spectral value Bessel (i+1) =besselj (i,5); Calculates the corresponding Bessel function value, mf=5Endabessel
4.FM signal non-coherent demodulation
%FM signal non-coherent demodulation FC= 5e3; %Carrier Frequency FS= 100e3; %Sample Rate N= Length (s_t); %sample points [lpf_b,lpf_a]= Butter (Ten, (fc/2)/(fs/2)); %Design Low-pass filter T= (0: N-1)'/fs;% time Tr_t =s_t;r_d_t= [0;d iff (r_t)]; %Seeking differential r_e_t= ABS (Hilbert (r_d_t)); %Envelope Detection demod_t= Filter (Lpf_b, lpf_a, r_e_t); %filter Plot (t, demod_t,'b'); % drawing
5. Demodulation FM Stereo Broadcast
%%FM stereo Broadcast demodulation clear All;clc;close allload'Fm_cap.mat'; %Load FM signal FC= 200e3; %Carrier Frequency FS= 2e6; %Sample Rate r_t=Fm_cap; N= Length (r_t); %sample points [lpf_b,lpf_a]= Butter (Ten, (fc/2)/(fs/2)); %Design Low-pass filter T= (0: N-1)'/fs;% time T%%demodulation r_d_t= [0;d iff (r_t)]; %Seeking differential r_e_t= ABS (Hilbert (r_d_t)); %Envelope Detection demod_t= Filter (Lpf_b, lpf_a, r_e_t); %filter Plot (t, demod_t,'b'); %Drawing%%signal extraction To enable the sound card to play audio Demod_t2= Resample (demod_t,48e3,2e6);%proportionally reduces the sample rate demod_t2=demod_t2/max (DEMOD_T2);normalized to limit the range of audio amplitude, otherwise it will not play FS2=48e3;%New sample Rate N2= Length (DEMOD_T2); %new Sample points T2= (0: n2-1)'/FS2;% New Time tPlot (T2, Demod_t2,'b'); %drawing Sound (DEMOD_T2,FS2);% Play Audio
Communication principle Experiment (II): Frequency modulation and demodulation & signal interpolation and extraction