|
Post by dietsoda on Mar 20, 2012 11:18:18 GMT -5
Hi, I am trying to replicate the first tutorial on PLLs and am wondering if I have a misunderstanding about the implementation. I have tried filtering s3 with a sum and explicitly using the equation for se and neither works. Here is my MATLAB code, if anyone has any suggestions it would be greatly appreciated! Thank you!
clear all w1= pi/20; % rad/s w2=pi/20; A1= 1; A2= 1; Km= 1; K0= 1; s1_reg= zeros(200,1); s2_reg= zeros(200,1); s3_reg= zeros(200,1); se_reg= zeros(200,1); phi2_reg= zeros(200,1); se=0; phi1= pi/19; phi2= pi/18;
for g=1: 200 s1= A1*sin(w1*g+ phi1); s1_reg(g)= s1;
s2= A2*cos(w2*g+ phi2); s2_reg(g)= s2;
s3= s1*s2; s3_reg(g)= s3;
%filter %if g>2 %se= sum(s3_reg(g-2:g)); se= Km*A1*A2*0.5*sin(phi1-phi2); se_reg(g)= se; %end phi2= 2*pi*K0*se*g; phi2_reg(g)= phi2; end
|
|