# Matlab code for Simulating of Phase Noise for OFDM systems [closed]

I am trying to simulate phase noise for OFDM systems. I have been reading about phase noise, some literature suggests that phase noise is cumulative as follows:

$$\phi(n)=\phi(n-1)+\omega(n)$$

where $$\omega(n)$$ is a Gaussian random variable. The received OFDM signal is expressed as:

$$r(n)=x(n)e^{j\phi(n)}$$ where $$x(n)$$ is the transmitted OFDM signal.

I am looking for Matlab code for phase noise simulation. thanks

• You can set the initial $\phi(0)$ then you just need to generate the Gaussian r.v. which can be done in MATLAB using the randn function – Engineer Apr 12 at 20:04
• This is great code for simulating phase noise by Alex Barr-Guy: mathworks.com/matlabcentral/fileexchange/8844-phase-noise – Dan Boschen Apr 13 at 11:22

Below is a short code to do this for 1024 samples. "phi" array below is the required phase for each samples

N=1024; %number of samples

phi=zeros(1,N);
phi(1,1) = pi/4;. %initial phase, could be set to zero if the phase is set to zero by the front end processing

Phase_snr=10; %snr in phase estimation,equivalent to 1db

for n=1:N-1
phi(1,n+1)=phi(1,n) + (1/sqrt(phase_snr))*randn(1);
end

• Thank you very much. Could you please explain the equation? Why phi(1,1) = pi/4 ? and why (1/sqrt(phase_snr))? Thanks – Amro Goneim Apr 12 at 21:41
• @Amro Goneim Phi(1,1) corresponds to the initial phase of the first sample. This has to be given for the recursive equation to start. Think of it as the initial condition. And the phase_snr and just defines the relative power between the phase terms and nosie $\w(n)$. It is essentially giving us the ability to decide how much the noise effects the phases. For ex: if we set phase_snr to 0.01. This would mean noise power is 2db above the actual phase signal – Dsp guy sam Apr 12 at 21:47
• You are welcomed – Dsp guy sam Apr 12 at 21:52