Gaussian Noise Generation with MATLAB

784 Views Asked by At

I am a Matlab beginner & need to understand what is going on this code. I know it is for Gaussian noise generation, but what do these variables mean mathematically?

N=5000;
W0= [0.1 0.3 0.5 ];
L= length(W0);
input= randn(1,N+L-1);
SNR_DB= 30;
SP=1;
NP=10^(-SNR_DB/10);
noise= sqrt(NP)*randn(1,N);
plot(1:N,noise)
1

There are 1 best solutions below

1
On BEST ANSWER
  • $N=5000$.
  • $W_0$ is a vector $(0.1, 0.3, 0.5)$
  • $L$ is the length of $W_0$, i.e. $3$.
  • input is a $1\times(N+L-1)$ matrix, i.e. a row vector of length $5002$. Its entries are filled with stardard normal (pseudo)random numbers (randn). For some curious reason, this vector is not used anywhere.
  • SNR_DB, SP and NP are three parameters. Again, the first two parameters are initiated but not used anywhere.
  • noise is a row vector of length $5000$ whose entries are standard normal random numbers scaled by $\sqrt{NP}$; that is, its entries are normally distributed with mean zero and standard deviation $\sqrt{NP}$.
  • The values of the entries of noise are plotted in a graph.

For any further questions about Matlab commands, type help in the Matlab command window. E.g. help randn would tell you the meaning of randn.