Oguzhan Ozel
Oguzhan Ozel

Reputation: 1164

How to implement feedback loop for PLL in Matlab?

I am trying to implement PLL demodulator for FM signal in Matlab, without using Simulink.

(FM Signal) >----Multiply---Loop Filter------> (Demodulated signal)
                     |                    |
                     ^                    V
                     |--------VCO---------|

My plan is to use above configuration. I have filter, VCO as functions, now I should combine them in a feedback mechanism. What kind of code structure should I use for this?

Upvotes: 1

Views: 1163

Answers (2)

Aaron
Aaron

Reputation: 11

Check out: Simulating phase locked loops (PLLs) with MATLAB

Upvotes: 0

Rattus Ex Machina
Rattus Ex Machina

Reputation: 462

Assuming you have your input (FM) signal in a vector U, then something along these lines will work if your functions act on one sample at a time.

N = length(U);
v = 0; % initial value for v

for n = 1:N

    x = U(n) * v;
    y = loop_filter(x);
    v = vco(y);

    % store output
    Y(n) = y;

end

It won't be fast, but that may not be your concern, here.

Upvotes: 1

Related Questions