First, FM modulation 1, the code is as follows:
CLC,CLEAR;FM= -; %modulation signal frequency (Hz) Am=0.5; %modulation signal Amplitude FC= 5e3; %Carrier Frequency (Hz) Ac=1; %Carrier amplitude MF=5; %FM Index%%%FIRSTLYKF= MF *2* PI * FM/AMDIATF= KF *AmB=2* (MF +1) *FM%%%SECONDLYFS= 64e3; %Sample Rate N= the; %number of sample points T= (0: N-1)'/fs;% time T%plotting time domain waveform m_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 figure (1) Subplot (1,3,1) plot (T, s_t,'b'); %plot waveform Xlabel (' Time'); Ylabel ('amplitude'); Title ('Time Domain waveform');%Draw Power Spectrum L= Length (s_t); %get sequence length u= Fftshift (FFT (s_t)); %discrete Fourier transform to find Spectrum U_pow= POW2DB (ABS (u). ^2); %amplitude to dBW= (0: L-1)'*fs/l-1/2*fs; % horizontal axis-frequencySubplot (1,3,2);p Lot (w, u_pow); Grid On;xlabel ('frequency (Hz)'); Ylabel ('magnitude (DB)'); Title ('Power Spectrum');%%%Fortly[lpf_b,lpf_a]= Butter (3, (fc/5)/(fs/2)); %Design Low-pass filter T= (0: N-1)'/fs;% time Tr_t =S_t;subplot (1,3,3) r_d_t= [0;d iff (r_t)]; %Seeking differential r_e_t= ABS (r_d_t); %Envelope Detection demod_t= Filter (Lpf_b, lpf_a, r_e_t); %filter Plot (t, demod_t,'b'); %Drawing Title ('demodulation Waveform');%%%Thirdlyfs_j=100e3;t=(0: N-1)';n_j=3000000; T_j=(0: n_j-1)';SM=am*cos (2*pi*fm/fs*t); Sfm_j=ac*cos (2*pi*fc/fs_j*t_j+mf*sin (2*pi*fm/fs_j*t_j)); SFM=FFT (Sfm_j); Figure;plot (ABS (SFM));=0:9J=BesselJ (I,MF); J_comp=abs (j/j (1))
2. Analysis of results
In the power spectrum analysis, the sampling point can be increased, and the sample point of the plot is not changed, the resulting power spectrum will be more discrete, easy to compare with Bessel function.
Second, L+r audio modulation
1. Process Design
2, the code is as follows
clear ALL;CLC;%load signal Load ('Fm_cap.mat'); Fm_cap= Resample (Fm_cap,1,4); %reduce sample rate FS= 500e3; %Sample Rate N= Length (FM_CAP); %Sample points T= (0: N-1)'/fs; % time tr_d_t= [0;d iff (FM_CAP)]; %Seeking differential r_e_t=ABS (Hilbert (r_d_t)); r_e_t= R_e_t-sum (r_e_t)/N;plot (t, r_e_t,'b'); %drawing [lpf_b,lpf_a]= Butter (5, 10e3/(fs/2)); %Design Low-pass filter demod_t= Filter (Lpf_b, lpf_a, r_e_t); %Filter demod_t= Resample (demod_t, -, the);d emod_t= demod_t./Max (demod_t); sound (demod_t,64e3);
Practice of Communication Principle (iii)--FM modulation