0
\$\begingroup\$

I am trying to design a phase locked loop in MATLAB's Simulink. For this, I am following this basic block diagram design:

Block Diagram

My original message signal is ~12 seconds long, has a bandwidth of approximately 22.05kHz, and has been sampled at 44.1kHz. I have imported it into Simulink using the 'from workspace' block with a sample time of (1/44100). For testing purposes, I am only simulated .25 seconds of time.

I then run my message through a 'zero-order hold' block which has a sampling time of (1E-7) which is then used throughout the rest of the system.

From the output of the Zero-Order Hold, I input my signal into an FM modulator with a Kf = 77017.868 and a carrier frequency of 1MHz. The Kf has been chosen due to a constraint that my peak frequency deviation must be 75kHz, and the maximum amplitude of the 12 second message signal is .9738V.

To model the phase detector, I have used a product block and a LPF to cutoff the frequencies at twice my carrier frequency. I have implemented the LPF using MATLAB's 'butter' function to generate the coefficients for a butterworth function. The following code is here:

Phase LPF Code

The loop filter is implemented with a transfer function of (s+a)/s, where '1/a' I have calculated must be less than 1E-7 (my sample rate). I do this because I need the phase error to decay to zero (or near zero) in a time-span that is less than the time difference between samples. Therefore in my head, any value where a > 1E7 should suffice. My work for how I calculated various components is here:

EDIT: (I have re=calculated these values below, but I will leave these old ones here for documentation) Page 1 Page 2

Finally, the continuous-time VCO has a carrier frequency of 1MHz as well as a Kv = 77017.868. Below is a image showing how I have configured the simulation in Simulink: (where the amplifier normally has a gain of u calculated above)

Simulink Setup

I believe I must have some fundamental misunderstanding of how the phase locked loop behaves, as I know for a fact that if I choose my values correctly this system design will demodulate the signal correctly. Instead, I see behavior that I cannot even describe properly or make any sense of. For instance, below will be a graph of the original waveform before undergoing FM modulation next to a graph of the output of the phase locked loop. What am I simply not understanding?

If there is any information that I can provide I will be happy to do so.

.25 seconds of original waveform: enter image description here .25 seconds of output of pll: enter image description here

EDIT: I re-calculated the values for the loop filter transfer function, where a is the constant in the loop filter transfer function (s+a)/s, and I made sure that 1/(Zeta * Wn) < Ts. Where my Ts is 1e-7.

enter image description here

Okay, so I decided to simplify the process a bit so it would be easier to troubleshoot. I have since removed my audio waveform and replaced it with a 16Hz sinewave with an amplitude of 0.95 (I did not want to exceed the maximum value of my message). This yielded the following result, where the blue line is the output of the phase locked loop and the yellow wave is the original input.

enter image description here

Next, and I have no idea why this does anything, I changed the carrier frequency from 1MHz to 10Mhz (without changing any sampling rates). If anyone could explain why this is the new result having ONLY changed the carrier frequency of the FM modulator and VCO, I would appreciate it:

enter image description here

Next, I decided to play with the order of the LPF that follows the mixer. In the picture above, the order of the butterworth filter is 13. I actually simulated with all filter orders between 1 and 50, and I thought these were the most interesting results:

Butterworth LPF Filter Order 17:

enter image description here

Butterworth LPF Filter Order 19:

enter image description here

Butterworth LPF Filter Order 27:

enter image description here

Butterworth LPF Filter Order 35:

enter image description here

I certainly do not understand this behavior. The order of the filter seems to heavily affect the accuracy of the phase locked loop, which does not make sense to me. I had an understanding that the Phase Detector's LPF only cutoff the higher frequency components after the two signals are multiplied together. I thought that the following loop filter controlled stability, oscillations, etc..

What also seems strange is that there seems to be a "sweet" spot of the filter orders around 17. If the order becomes too high or too low, effectively no signal is produced at the demodulator output.

\$\endgroup\$
  • 1
    \$\begingroup\$ Filter controls group delay in the forward path. At high order, this will lead to instability and indeed chaotic behaviour. (Also, it becomes absurdly difficult to realise in real analog circuitry. Try limiting yourself to order 4 or 6. (Also bring the passband down to about 0.4* sampling frequency). Stabilising loops around even order 2 filters can be tricky. So you'll apparently have to fix something else too. \$\endgroup\$ – Brian Drummond Dec 2 '17 at 12:39
  • \$\begingroup\$ Would the phase response of higher order filters be the reason it creates instability in the system? Also do you mean the passband FM modulator sampling rate? Would the system not be able to correctly sample the modulated waveform if the sampling rate is much lower than the modulated frequency? \$\endgroup\$ – Zearia Dec 2 '17 at 20:25
  • \$\begingroup\$ In lines with what @BrianDrummond said, make the lowpass filter only a 1st, or maximum 2nd order, and try adding a constant, reference \$\omega\$ with a summer before the loop filter. Some time might be needed for the PLL to lock on, also. \$\endgroup\$ – a concerned citizen Nov 26 '18 at 7:14
0
\$\begingroup\$

You want MEMORY of the prior frequency information, in the Loop Filter. Give the loop filter 10uSecond timeconstant, so you begin to learn what depends upon what.

\$\endgroup\$
  • \$\begingroup\$ Is the time constant you are referring to 1 / (Zeta * Wn) ? \$\endgroup\$ – Zearia Dec 2 '17 at 4:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.