Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Phase Locked Loop matlab design help needed

Status
Not open for further replies.

sixers0130

Newbie level 1
Joined
Oct 31, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Los Angeles
Activity points
1,297
hey guys this is my first time to post question here...
I need to design a PLL by using matlab, but what my professor lectures in class is very confusing.


Here's my matlab code and also attached:

e = zeros(1,1000); % Initializing the error signal
wc = 2*pi*95/800; % Omega for the signal coming out from VCO
% with initial frequency 95Hz and sampling frequency
% 800Hz
k = 5; % Variation allowed - Gain from VCO
h = [0.5 0.5]; % Loop filter - averager, take the last two error signal and average them
for n = 2:1000
s1(n) = cos((2*pi*100/800)*n + pi/3); % incoming signal
s1(1) = cos(2*pi*100/800 + pi/3); % Initializing at n = 1 since the loop starts at n = 2
s2(n) = sin((wc+k*e(n-1))*n + pi/8); % signal coming out from VCO
s2(1) = sin(wc + pi/8); % Initializing
z = s1.*s2; % Mixer
filter = [(z(n-(length(h)-1))) z(n)]; % Take the last 2 data relative to current n
e(n) = sum(h.*filter); % Get the average
end
t = 1:1000;
plot(t,e)



1. The output of the error signal e(n) never goes to 0, so there must be something wrong. My professor says you can use a averager as a loop filter. But I don't know how can that be true if we don't use a lowpass filter to discard that information we don't want first.

2. If I want to use a lowpass filter how can I do that? I tried to use butterworth functions in matlab but I just don't understand what to put in the arguments and what they means.

3. 100Hz is the frequency of the incoming signal s1 and the target frequency. s2 has initially 95Hz of frequency with 800Hz sampling frequency on both of them.

4. The phase shift of s1 and s2 (pi/3 and pi/8) are set randomly. Do they really matter or can they both can be zero?

Thank you guys!
 

Attachments

  • pll.jpg
    pll.jpg
    50.7 KB · Views: 122
  • pll_matlab_code.doc
    27 KB · Views: 91

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top