利用锁相环实现载波同步
一:实验目的:利用matlab验证锁相环实现载波同步的原理和方法。
二:实验要求:设输入已调信号为FM信号,该调频信号由100Hz的消息正选拨调制1kHz的载频而成。试用锁相环从已调信号中提取载波信号,实现载波同步。
三:实验原理:
FM调制原理:FM是由基带信号来调制载波信号的角频率,使其随基带信号线性变化; 锁相环提取载波原理:
入信号
鉴相器 PD 环路滤波器 LF 压控振荡VCO出U0(t) 器 VCO
四:实验源码:
clear all; close all;
f=1000;êrrier
fs=100000;%Sample frequency N=5000;%Number of samples Ts=1/fs;
t=(0:Ts:(N*Ts)-Ts);
%Create the message signal f1=100;%Modelating frequency msg=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 carrier
Signal1=exp(j*(2*pi*f*t));%Unmodulated carrier %Initilize PLL Loop phi_hat(1)=30; e(1)=0;
phd_output(1)=0;
vco(1)=0;Tfine Loop Filter parameters(Sets damping) kp=0.15;%Proportional constant ki=0.1;%Integrator constant %PLL implementation for n=2:length(Signal)
vco(n)=conj(exp(j*(2*pi*n*f/fs+phi_hat(n-1))));% %Compute VCO
phd_output(n)=imag(Signal(n)*vco(n));%Complex multiply VCOxSignal input e(n)=e(n-1)+(kp+ki)*phd_output(n)-ki*phd_output(n-1); %Filter integrator
phi_hat(n)=phi_hat(n-1)+e(n); %Update VCO end;
%Plot waveforms startplot=1; endplot=1000; figure(1);
subplot(3,2,1);
plot(t(startplot:endplot),msg(startplot:endplot)); title('消息信号(频率100Hz)'); %xlable(‘Time(seconds)’); ylabel('幅度'); grid;
figure(1);
subplot(3,2,2);
plot(t(startplot:endplot),real(Signal(startplot:endplot)));
title('FM已调信号(用100Hz的消息信号调制');%xlable(‘Time(seconds)’); ylabel('幅度'); grid; figure(1)
subplot(3,2,3);
plot(t(startplot:endplot),e(startplot:endplot)); title('环路虑波器的输出'); ylabel('幅度'); grid;
subplot(3,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)');
1KHz的载波)xlabel('Time(seconds)'); ylabel('幅度'); grid;
五:实验结果及分析:
消息信号是一个单音频信号见subplot(3,2,1),由它来调制载波得已调信号见 subplot(3,2,2),锁相环从已调信号中提取载波信号, 见subplot(3,2,5)是与载波同频同相的本地载波。
消息信号(频率100Hz)FM已调信号(用100Hz的消息信号调制1KHz的载波)11幅度0-10.5幅度00.005环路虑波器的输出0.010-1100.005压控振荡器的输出0.01幅度0-0.500.005鉴相器的输出10.01幅度0-100.005Time(seconds)载波(频率1kHz)0.011幅度0-1幅度00.005Time(seconds)0.010-100.005Time(seconds)0.01
相关推荐: