% ----------------------------------------------------------------------
% *********************INITIAL SETUP*********************
clear all;
format long;
% ----------------------------------------------------------------------
% *********************PLL PARAMETERS*********************
f = linspace (1, 1e9, 20000);
w = 2*pi*f;
% Input Clock Frequency
FIN = 5e7;
fs = 1/10e-12;
% Charge Pump parametere
% ICP = 27e-6;
ICP = 20e-6;
err_1 = 0;
err_2 = 0;
SR = 10e9; %Slew Rate is 1V in 100ps
% Loop Filter parameters
w3db = 3.76e+06;
RzList = [9.99e+03,9.99e+03,9.99e+03];
Cz_df5 = ICP*(2e+09)/2/pi/16/(w3db/15)^2;
Cz_df1 = ICP*(2e+09)/2/pi/16/(w3db/3)^2;
Cz_df02 = ICP*(2e+09)/2/pi/16/(w3db/0.6)^2;
Cz = 1.0132e-11;
% Cp = 0.1*Cz;
% KVCO parameters.
Kv = 1/pi*1e9; %In Hz/V for simulink
KVCO = 1e9*2; %In rad/V
KvcoOffset = 0;
Fo = 1*1e7;
% Fo = 2.3e9;
% Divider Parameters
N = 16;
% ----------------------------------------------------------------------
% *********************START SIMULATION*********************
Rz = RzList(2);
options=simset('MaxStep',1/fs,...
'RelTol',3e-3/fs,'AbsTol',1e-4/fs, ...
'Solver','ode45',...
'ZeroCross','on' );
% sim('PLL_ab004',[0 5e-6], options)
sim('PLL_Final2_2',[0 5e-6], options)
% ----------------------------------------------------------------------
% *********************POST PROCESSING*********************
%******************** BELOW IS FOR IDEAL Processing Result********************
% k=1;
% for i = [1,2,3]
%
%
% Rz=RzList(k);
% disp(Rz);
% % Kpd = ICP/(2*pi);
% % Kpd = (27e-6)/(2*pi);
% Kpd = (20e-6)/(2*pi);
% Kfwd = Kpd*KVCO;
% Kloop = Kfwd/N ;
% a1 = Rz*Cz;
% b21 = Cz;
% % b22 = (Cp+Cz);
%
%
% % syms x
% % S =solve(x^2 +Kloop*Rz*x + Kloop/Cz == 0,x);
% % disp(S);
% %
%
%
%
% Aopenloop_num = [N*2*DFLIST(i)*(32*pi*1e7),N*(2*pi*1e7)^2];
% Aopenloop_den = [1,DFLIST(i)*(32*pi*1e7),(32*pi*1e7)^2];
% Aopenloop = freqs(Aopenloop_num,Aopenloop_den,w);
% Gain_Open_Loop = db(abs(Aopenloop));
% Phase_Open_Loop = (180/pi)*angle(Aopenloop);
%
% Zero = abs(roots(Aopenloop_num)/(2*pi));
% Pole = abs(roots(Aopenloop_den)/(2*pi));
% % BW = Kpd*KVCO*Rz/N*(Cz/(Cz+Cp))/(2*pi);
% DF = Rz/2*(Kpd*KVCO*Cz/N)^(1/2);
% DFNEW = ((Kpd*KVCO/Cz/N)^(1/2))/2*Rz*Cz;
%
%
% [y, x1] = min(abs(Gain_Open_Loop));
% Unity_Gain_Frequency = f(x1);
% Phase_Margin = Phase_Open_Loop(x1) + 180;
% Natural_freq = Unity_Gain_Frequency/(2*DF);
%
% %open loop try
% % figure;
% % OPLOOP_Numerator = [Kpd*KVCO*Rz,Kpd*KVCO/Cz];
% % OPLOOP_denominator = [1,0,0];
% % Transfer_Function_OPLOOP = tf(OPLOOP_Numerator,OPLOOP_denominator);
% % bode(Transfer_Function_OPLOOP);
% % figure;
% % Transfer_Function_Numerator = [N*2*DFLIST(i)*(32*pi*1e7),N*(2*pi*1e7)^2];
% % Transfer_Function_denominator = [1,DFLIST(i)*(32*pi*1e7),(32*pi*1e7)^2];
% % Transfer_Function_HS = tf(Transfer_Function_Numerator,Transfer_Function_denominator);
% % bode(Transfer_Function_HS);
% %
% % figure;
% % Error_Transfer_Function_Numerator = [1,0,0];
% % Error_Transfer_Function_denominator = [1,DFLIST(i)*(32*pi*1e7),(32*pi*1e7)^2];
% % Error_Transfer_Function_HS = tf(Error_Transfer_Function_Numerator,Error_Transfer_Function_denominator);
% % bode(Error_Transfer_Function_HS);
%
% %
% % figure
% % subplot(2,1,1)
% % semilogx(f,Gain_Open_Loop,'Color','b','LineWidth',2);
% % title('The Gain Plot of the Open Loop Transfer Function');
% % xlabel('frequency (Hz)');
% % ylabel('Gain (dB)');
% % grid on;
% %
% % subplot(2,1,2)
% % semilogx(f,Phase_Open_Loop,'Color','b','LineWidth',2);
% % title('The Phase Plot of the Open Loop Transfer Function');
% % xlabel('frequency (Hz)');
% % ylabel('Phase (degrees)');
% % grid on;
% %
%
% %
% % % Closed Loop Analysis of the VCO (Low Pass Transfer Function)
% %
% % Alowpass_num = Kfwd*N*[a1 1];
% % Alowpass_den = [N*b21 N*b22 a1*Kfwd Kfwd];
% % Alowpass = freqs(Alowpass_num,Alowpass_den,w);
% % Gain_Low_Pass = db(abs(Alowpass));
% %
% % % Closed Loop Analysis of the VCO (High Pass Transfer Function from the VCO
% % % input to the output)
% %
% % Ahighpass_num = (N)*[b21 b22 0 0];
% % Ahighpass_den = [N*b21 N*b22 a1*Kfwd Kfwd];
% % Ahighpass = freqs(Ahighpass_num,Ahighpass_den,w);
% % Gain_High_Pass = db(abs(Ahighpass));
% %
% % % Closed Loop Analysis of the VCO (Band Pass Transfer Function from the VCO
% % % output to the output)
% %
% % Abandpass_num = N*KVCO*[b21 b22 0];
% % Abandpass_den = [N*b21 N*b22 a1*Kfwd Kfwd];
% % Abandpass = freqs(Abandpass_num,Abandpass_den,w);
% % Gain_Band_Pass = db(abs(Abandpass));
% %
% % figure
% % subplot(3,1,1)
% % semilogx(f,Gain_Low_Pass,'Color','g','LineWidth',2 );
% % title('Low Pass Transfer Function (for Reference Noise)');
% % xlabel('frequency (Hz)');
% % ylabel('Gain (dB)');
% % grid on;
% % %
% % subplot(3,1,2)
% % semilogx(f,Gain_High_Pass,'Color','r','LineWidth',2);
% % title('High Pass Transfer Function (for CLK Buffer Noise)');
% % xlabel('frequency (Hz)');
% % ylabel('Gain (dB)');
% % grid on;
% %
% % subplot(3,1,3)
% % semilogx(f,Gain_Band_Pass,'Color','b','LineWidth',2);
% % title('Band Pass Transfer Function (for VCO input Noise)');
% % xlabel('frequency (Hz)');
% % ylabel('Gain (dB)');
% % grid on;
%
% % figure;
% %
% % semilogx(f,Gain_Low_Pass,'Color','g','LineWidth',2);
% % hold on; grid on;
% % semilogx(f,Gain_High_Pass,'Color','r','LineWidth',2);
% % hold on; grid on;
% % semilogx(f,Gain_Band_Pass,'Color','b','LineWidth',2);
% % legend ('Gain Low Pass','Gain High Pass','Gain Band Pass',4);
% % Title('Noise Transfer function, N=480' );
% % xlabel('frequency (Hz)');
% % ylabel('Noise Transfer function (dB)');
% % grid on;
% %
% %
% % For step response
% wz = 2*pi*Zero ;
% wp = 2*pi*max(Pole) ;
% wn = 2*pi*Natural_freq ;
% wd = wn*(1-DF^2)^0.5;
%
% figure;
% s = tf('s') ;
% HO = wn^2 * (1 + s/wz) / (s^2 * (1 + s/wp)) ;
% bode(HO) ;
% HC = wn^2 * (1 + s/wz) / (s^2 + ((wn^2)/wz)*s + wn^2) ;
% ltiview(HC) ;
%
% % Jitter due to input ref Noise in an Ideal Second-Order PLL
% %
% %
% % figure;
% % semilogx(f,Gain_Low_Pass,'Color','b','LineWidth',2 );
% % title('Low Pass Transfer Function (for Reference Noise)');
% % xlabel('frequency (Hz)');
% % ylabel('Gain (dB)');
% % hold on;
% % grid on;
% %
% % wn_l = 2.3e6;
% % df_l = 0.5;
% % wd_l = wn_l*(1-df_l^2)^0.5;
% % Num_l = N*[2*df_l*wn_l wn_l^2];
% % den_l = [1 2*df_l*wn_l wn_l^2];
% % NTF_LP=freqs(Num_l,den_l,w);
% % Gain_LP=db(abs(NTF_LP));
% % semilogx(f,Gain_LP,'Color','r','LineWidth',2);
% % legend ('3rd Order PLL','2rd Order PLL','3');
% %
% % fout = 2.4e9;
% % wout = 2*pi*fout;
% % cycles = 10000;
% % T = 1/fout;
% % d_T = cycles*T;
% % Nclk_in = 1e-6;
% % k_l = (4*pi^2*Nclk_in*N/(wout)^2)^0.5;
% %
% % % Jitter due by 1/f^
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Proj.rar (58个子文件)
Final3_21_phaseD
PLLabcFinal3_21.m 10KB
PLL_Final01.slxc 15KB
PLL_Final3_21.slxc 51KB
slprj
_jitprj
jitEngineAccessInfo.mat 830B
k1NrfCLgylieV27AzqR4SF.l 92KB
k1NrfCLgylieV27AzqR4SF.mat 244B
_cgxe
PLL_Final3_21
PLL_Final3_21_Cache.mat 1KB
_cprj
_sfprj
PLL_Final3_21
_self
sfun
info
binfo.mat 691B
amsi_serial.mat 236B
EMLReport
s3L0wxOPngFOEZFpzbVg52G
s3L0wxOPngFOEZFpzbVg52G.mat 3KB
sgtt2BtGa09VSC0oIlli5sD.mat 37KB
sgtt2BtGa09VSC0oIlli5sD
emlReportAccessInfo.mat 787B
sl_proj.tmw 83B
accel
PLL_Final3_21
amsi_serial.mat 236B
PLL_Final3_21_SolverChangeInfo.mat 740B
PLL_Final3_21_instrumentation_settings.mat 180B
PLL_Final3_21_top_vm.bc 60KB
tmwinternal
simulink_cache.xml 376B
rtwgen_tlc
PLL_Final01
PLL_Final01_instrumentation_settings.mat 180B
PLL_Final01_top_vm.bc 10KB
PLL_Final01_SolverChangeInfo.mat 740B
amsi_serial.mat 234B
tmwinternal
simulink_cache.xml 376B
rtwgen_tlc
PLL_Final3_1
PLL_Final3_1_top_vm.bc 17KB
PLL_Final3_1_instrumentation_settings.mat 180B
amsi_serial.mat 235B
PLL_Final3_1_SolverChangeInfo.mat 740B
tmwinternal
simulink_cache.xml 376B
rtwgen_tlc
sim
varcache
PLL_Final3_21
checksumOfCache.mat 392B
varInfo.mat 3KB
tmwinternal
simulink_cache.xml 376B
PLL_Final01
checksumOfCache.mat 392B
varInfo.mat 4KB
tmwinternal
simulink_cache.xml 376B
PLL_Final3_1
checksumOfCache.mat 392B
varInfo.mat 3KB
tmwinternal
simulink_cache.xml 376B
TEST.m 473B
PLL_Final3_21.mdl 166KB
PLL_Final3_1.slxc 19KB
FINAL2_2
PLL_Final2_2.mdl 133KB
PLL_Final2_2.slxc 17KB
PLLabcFinal2_2.m 10KB
slprj
_jitprj
jitEngineAccessInfo.mat 779B
u8WFigovq8iwtNLKJQIdUD.mat 244B
xJPscNjyFuqLkE7r0ZiFEH.mat 244B
u8WFigovq8iwtNLKJQIdUD.l 98KB
xJPscNjyFuqLkE7r0ZiFEH.l 98KB
_cgxe
PLL_Final2_2
PLL_Final2_2_Cache.mat 1KB
_cprj
sl_proj.tmw 80B
accel
PLL_Final2_2
PLL_Final2_2_top_vm.bc 10KB
PLL_Final2_2_SolverChangeInfo.mat 740B
PLL_Final2_2_instrumentation_settings.mat 180B
amsi_serial.mat 235B
tmwinternal
simulink_cache.xml 376B
rtwgen_tlc
sim
varcache
PLL_Final2_2
checksumOfCache.mat 392B
varInfo.mat 4KB
tmwinternal
simulink_cache.xml 376B
共 58 条
- 1
资源评论
ZXZ961126
- 粉丝: 2
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功