《利用锁相环实现载波同步.doc》由会员分享,可在线阅读,更多相关《利用锁相环实现载波同步.doc(3页珍藏版)》请在金锄头文库上搜索。
1、利用锁相环实现载波同步一:实验目的:利用matlab验证锁相环实现载波同步的原理和方法。二:实验要求:设输入已调信号为FM信号,该调频信号由100Hz的消息正选拨调制1kHz的载频而成。试用锁相环从已调信号中提取载波信号,实现载波同步。三:实验原理:FM调制原理:FM是由基带信号来调制载波信号的角频率,使其随基带信号线性变化;锁相环提取载波原理:环路滤波器 LF入信号VCO出U0(t)鉴相器PD压控振荡器 VCO四:实验源码:clear all;close all;f=1000;%Carrierfs=100000;%Sample frequencyN=5000;%Number of sampl
2、esTs=1/fs;t=(0:Ts:(N*Ts)-Ts);%Create the message signalf1=100;%Modelating frequencymsg=sin(2*pi*f1*t);kf=.0628;%Modulation index%Create the real and imaginary parts of a CW modulated carrier to be tracked.Signal=exp(j*(2*pi*f*t+2*pi*kf*cumsum(msg);%Modulated carrierSignal1=exp(j*(2*pi*f*t);%Unmodula
3、ted carrier%Initilize PLL Loopphi_hat(1)=30;e(1)=0;phd_output(1)=0;vco(1)=0;%Define Loop Filter parameters(Sets damping)kp=0.15;%Proportional constantki=0.1;%Integrator constant%PLL implementationfor n=2:length(Signal)vco(n)=conj(exp(j*(2*pi*n*f/fs+phi_hat(n-1);%Compute VCOphd_output(n)=imag(Signal(
4、n)*vco(n);%Complex multiply VCOxSignal inpute(n)=e(n-1)+(kp+ki)*phd_output(n)-ki*phd_output(n-1);%Filter integratorphi_hat(n)=phi_hat(n-1)+e(n);%Update VCOend;%Plot waveformsstartplot=1;endplot=1000;figure(1);subplot(3,2,1);plot(t(startplot:endplot),msg(startplot:endplot);title(消息信号(频率100Hz));%xlabl
5、e(Time(seconds);ylabel(幅度);grid;figure(1);subplot(3,2,2);plot(t(startplot:endplot),real(Signal(startplot:endplot);title(FM已调信号(用100Hz的消息信号调制1KHz的载波));%xlable(Time(seconds);ylabel(幅度);grid;figure(1)subplot(3,2,3);plot(t(startplot:endplot),e(startplot:endplot);title(环路虑波器的输出);ylabel(幅度);grid;subplot(3
6、,2,4);plot(t(startplot:endplot),real(vco(startplot:endplot);title(压控振荡器的输出);xlabel(Time(seconds);ylabel(幅度);grid;subplot(3,2,5);plot(t(startplot:endplot),phd_output(startplot:endplot);title(鉴相器的输出);xlabel(Time(seconds));ylabel(幅度);grid;subplot(3,2,6);plot(t(startplot:endplot),real(Signal1(startplot:endplot);title(载波(频率1kHz);xlabel(Time(seconds));ylabel(幅度);grid;五:实验结果及分析:消息信号是一个单音频信号见subplot(3,2,1),由它来调制载波得已调信号见 subplot(3,2,2),锁相环从已调信号中提取载波信号, 见subplot(3,2,5)是与载波同频同相的本地载波。