# Phase noise of a digital PLL

I assume the reader is aware of how a DPLL works.

• The DPLL oscillates with a frequency of $$\F_{out}\$$.
• The DCO free running frequency is $$\F_{free}\$$.
• In the model of our DPLL we've only considered the TDC quantization noise.
• The instantaneous frequency deviation is given, which is the change from $$\F_{free}\$$ to any frequency we want it to lock onto, say $$\F_{out}\$$. The following plot shows a 1MHz change until it locks:

where CKR with the average frequency $$\F_R\$$ is the retimed clock used to synchronize the internal DPLL operations. The index k represents the kth occurrence of the CKR's rising edge. Let's say that this curve is stored in a vector called ifd, which has a length of k, obviously.

Now given the frequency deviation I'm not sure as to how I could find the power spectral density of the output phase noise, which is mainly due to the TDC quantization with a limited resolution.

I understand that the phase is the time integral of the frequency multiplied by 2$$\\pi\$$, or $$\\phi=2\pi\int{ifd \ dt}\$$. We know ifd so we know $$\\phi\$$ by integration. Now in the context of MATLAB language the PSD is obtained

phi=2*pi*cumsum(ifd)/FR;
pn=f(phi);
% PSD
fs=10*FR;
[pxx,f]=pwelch(pn,[],[],[],fs,'onesided');
XdB=10*log10(pxx);


I'm actually stuck at the second line, where I don't know what f should be. Does anyone know what I should replace f with? Is that simply a sin function or something more complex than that?