tompham
Full Member level 2
Hi all
I am writing matlab code for PLL component. Below is my code:
function [C2,C1,R1] = PLLcom(ipump,vco_gain,fref,fout,bandwidth,phase_margin)
Kpd = ipump/2/pi; % phase detector gain
Kvco = vco_gain*2*pi; % vco gain
omega = 2*pi* bandwidth; % open loop bandwidth in radians/sec
N = fout/fref; % division ratio
pm = phase_margin*pi/180; %phase margin in radians/sec
%% Find T1 and T2
T1 = (sec(pm)-tan(pm))/omega;
T2 = 1/(omega*(sec(pm)-tan(pm)));
%% Solving for Loop Components
C2 = Kpd*Kvco/(N*omega^2)*T1/T2*sqrt((1+(omega*T2)^2)/(1+(omega*T1)^2));
C1 = C2*(T2/T1-1);
R1 = T2/C1;
The compile function shows no error. Why I can not get value of C1, R1?
I need someone to help me.
Thanks a lot
I am writing matlab code for PLL component. Below is my code:
function [C2,C1,R1] = PLLcom(ipump,vco_gain,fref,fout,bandwidth,phase_margin)
Kpd = ipump/2/pi; % phase detector gain
Kvco = vco_gain*2*pi; % vco gain
omega = 2*pi* bandwidth; % open loop bandwidth in radians/sec
N = fout/fref; % division ratio
pm = phase_margin*pi/180; %phase margin in radians/sec
%% Find T1 and T2
T1 = (sec(pm)-tan(pm))/omega;
T2 = 1/(omega*(sec(pm)-tan(pm)));
%% Solving for Loop Components
C2 = Kpd*Kvco/(N*omega^2)*T1/T2*sqrt((1+(omega*T2)^2)/(1+(omega*T1)^2));
C1 = C2*(T2/T1-1);
R1 = T2/C1;
The compile function shows no error. Why I can not get value of C1, R1?
I need someone to help me.
Thanks a lot