# Creating Periodic Noise in Matlab and then adding it to a signal

I am not sure if this is the correct forum for this question but here it goes. If this is not the correct forum please direct me to the appropriate forum.

I wish to add some periodic noise to a 1-D signal in Matlab. I have to create the noise myself. Now my issues is of the frequency and the sample size of the noise.

Lets say that the signal vector in which I wish to add noise has length x and in Matlab, as we know, when we wish to add two signals, the length of the vectors must be same, so I will have to create a noise with the same length x. Now first I have to decide the frequency f of the noise, which is a problem because in Matlab every thing is discrete and I am not sure whether my f should be a function of x because the value of f affects the length of my noise vector signal overall and also the shape/look of my noise vector.

I want to ask that what are the best practices to follow when creating and adding periodic noise to a signal of fixed length. For random/Gaussian random it is very easy as it is not periodic but what about periodic noise.

• Do you have a noise "color" in mind? White noise is by definition aperiodic (no correlation structure). – meawoppl Feb 23 '15 at 18:56

You start at the wrong end. Your question is about how to do it with a vector of length $N$ in Matlab but your question states that you are not clear about what periodic noise actually means in this case.

You can't ask how to do something you don't yet understand. You first need to understand what it is you want to do, and then actually doing it will become obvious.

So, in your case, you first need to figure out what the individual entries in your vector correspond to (time instances? locations?) and what periodicity and frequency actually mean in this context (e.g., if the elements of your vector correspond to locations on a 2d grid, do you want to be periodic in $x$ or $y$ direction). You then also have to ask what features your noise should have (e.g., a single frequency with random amplitude, or a particular power spectrum with random phases?).

Summary: You can't correctly implement something for which you don't know what "correct" actually means.