锁相环路matlaB程序.wps

上传人:b****3 文档编号:2485331 上传时间:2022-10-30 格式:WPS 页数:3 大小:3.53MB
下载 相关 举报
锁相环路matlaB程序.wps_第1页
第1页 / 共3页
锁相环路matlaB程序.wps_第2页
第2页 / 共3页
锁相环路matlaB程序.wps_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

锁相环路matlaB程序.wps

《锁相环路matlaB程序.wps》由会员分享,可在线阅读,更多相关《锁相环路matlaB程序.wps(3页珍藏版)》请在冰豆网上搜索。

锁相环路matlaB程序.wps

1锁相环路matlaB程序%PLLillustrationusingMATLABclearall;%closeall;%定义初始相位偏移和输入连续波频率以及采样频率theta=60*pi/180;f=1e3;fs=100e3;%生成未调制连续波的实部和虚部k=1:

1:

1000;delf=f/20;cpx1=exp(j*(2*pi*k*(f+delf)/fs+theta)+.01*(rand(1,1000)+j*rand(1,1000);%初始化锁相环phi_hat

(1)=30;e

(1)=0;phd_output

(1)=0;nco

(1)=0%定义环路滤波器参数kp=0.15;%比例常数ki=0.1;%积分常数%锁相环的实现forn=2:

length(cpx1)nco(n)=conj(exp(j*(2*pi*n*f/fs+phi_hat(n-1);%数控振荡器phd_output(n)=imag(cpx1(n)*nco(n);%鉴相e(n)=e(n-1)+(kp+ki)*phd_output(n)-ki*phd_output(n-1);%滤波some(n)=(kp+ki)*phd_output(n)-ki*phd_output(n-1);phi_hat(n)=phi_hat(n-1)+e(n);%更新数控振荡器end;%绘图index_stop=200;figuresubplot(211),plot(1:

index_stop,phd_output(1:

index_stop),ylabel(Ph.Det.)subplot(212),plot(1:

index_stop,phi_hat(1:

index_stop)*180/pi),ylabel(Est.Phs.)figure,index_stop=200;subplot(211),plot(1:

index_stop,real(nco(1:

index_stop),1:

index_stop,real(cpx1(1:

index_stop),ylabel(RE-PLL)subplot(212),plot(1:

index_stop,imag(nco(1:

index_stop),1:

index_stop,imag(cpx1(1:

index_stop),ylabel(IM-PLL)23

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1