This is a simple program written so the equations look like classical matrix equations and it solves the voltage out of the standard current driven loop filter. This is intended to be used in some future PLL analysis program, but it outlines the way to set up the equations, and solve them. There are other. more comprehensive SPICE like programs available, but this gives you the idea in an appropriate format, and can be adopted for analysis of other small circuits. There are explanations throughout the file. The input is a simple sinusoid, this can be replaced by some more complex waveform. As usual, this file needs just basic MatLab.