欢迎来到天天文库
浏览记录
ID:28151487
大小:157.00 KB
页数:13页
时间:2018-12-08
《锁相环仿真_MATLAB仿真程序代码_二阶锁相环仿真过程.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、锁相环仿真_MATLAB仿真程序代码_二阶锁相环仿真过程 本蚊介绍了仿真的环境以及二阶锁相环的仿真过程,并对其仿真结果进行了分析。在前三章的理论基础上,通过使用MATLAB7.0进行了仿真。 验结果表明:用MATLAB进行的二阶锁相环仿真达到了最初的设想,锁相环的失锁、跟踪、捕获、锁定各个阶段均有体现。达到了最初仿真的要求。 (典型仿真案例)图 仿真使用软件MATLAB7.0 仿真使用的软件是MATLAB7.0。由于MATLAB仿真软件适合多学科、多种工作平台且功能强大、界面友好、方便快捷、语言自然并且开放性强的大型优
2、秀应用软件,已经也已成为国内外高等院校高等数学、数值分析、数字信号处理、自动控制理论以及工程应用等课程的基本教学工具。使用Matlab对锁相环仿真的实现是方便快捷的。 仿真采用二阶锁相环 仿真所采用的是二阶锁相环。这是由于我们实际应用中的绝大多数PLL,或者是二阶的,或者是通过忽略高阶效应(至少在初步设计时)而被设计成近似的二阶环路。鉴于二阶锁相环在实际应用的意义,所以在仿真采用了二阶锁相环。 MATLAB仿真程序代码 %File:c6_nltvde.m w2b=0;w2c=0;%iniTIalizeintegrato
3、rs yd=0;y=0;%iniTIalizedifferenTIalequaTIon tfinal=50;%simulationtime fs=100;%samplingfrequency delt=1/fs;%samplingperiod npts=1+fs*tfinal;%numberofsamplessimulated ydv=zeros(1,npts);%vectorofdy/dtsamples yv=zeros(1,npts);%vectorofy(t)samples % %beginningofs
4、imulationloopfori=1:nptst=(i-1)*delt; %time ift《20 ydd=4*exp(-t/2)-3*yd*abs(y)-9*y;%defort《20 else ydd=4*exp(-t/2)-3*yd-9*y; %defort》=20end w1b=ydd+w2b;%firstintegrator-step1w2b=ydd+w1b; %firstintegrator-step2 yd=w1b/(2*fs);%firstintegratoroutputw1c=yd+w2c;%
5、secondintegrator-step1w2c=yd+w1c; %secondintegrator-step2 y=w1c/(2*fs);%secondintegratoroutputydv(1,i)=yd;%builddy/dtvectoryv(1,i)=y;%buildy(t)vectorend %endofsimulationloop plot(yv,ydv)%plotphaseplanexlabel(‘y(t)’)%labelxaxisylabel(‘dy/dt’) %labelyzxis %Endofs
6、criptfile.%File:pllpost.m % kk=0;whilekk==0k=menu(‘PhaseLockLoopPostprocessor’,。。。 ‘InputFrequencyandVCOFrequency’,。。。 ‘InputPhaseandVCOPhase’,。。。 ‘FrequencyError’,‘PhaseError’,‘PhasePlanePlot’,。。。 ‘PhasePlaneandTimeDomainPlots’,‘ExitProgram’); ifk==1 plot(t,
7、fin,‘k’,t,fvco,‘k’) title(‘InputFrequencyandVCOFreqeuncy’) xlabel(‘Time-Seconds’);ylabel(‘Frequency-Hertz’);pause elseifk==2 pvco=phin-phierror;plot(t,phin,t,pvco) title(‘InputPhaseandVCOPhase’) xlabel(‘Time-Seconds’);ylabel(‘Phase-Radians’);pause elseifk==3pl
8、ot (t,freqerror);title(‘FrequencyError’) xlabel(‘Time-Seconds’);ylabel(‘FrequencyError-Hertz’);pause elseifk==4 plot(t,phierror
此文档下载收益归作者所有