## How to synthesize band-limited noise?

Started by 3 years ago15 replieslatest reply 3 years ago1479 views

Hello everyone,

My goal is to generate band-limited noise. Simply: user defines BW and my task is to generate time domain complex samples to imitate defined band nosie. I have to implement this in C/C++ and I don't have an access to any DSP library. Question to you: what would be the simplest approach to generate band-limited noise? There is no special requirements if it comes to the "shape" of the spectrum. Lets say that 95% of the generated noise has to reside in user-defined bandwidth.

Any suggestions how to deal with that problem?

Or maybe someone have already had this kind of problem and could share the source code or at least share the idea?

Best regards,

Marcin

[ - ]

It would help to know more about what you want. Do you want to generate one indefinite length stream of random numbers? Or do you want to generate a finite length sequence of given length?   Do you want the program to run as fast as possible, or to be the fewest lines of code? Do you care if the probability distribution is gaussian or could it  be arbitrary?

For a single finite length sequence, least code, generate N uniformly distributed random numbers and zero out some of them, the frequencies you want to be missing. Then compute the DFT for your answer. This is probably a least-code approach.

For a sequence of indefinite length, you want a digital filter which can be applied to a noise source. If the bandwidth is small compared to the sampling rate, the filter will make the output gaussian. Otherwise, or for great accuracy, you can transform a uniform random sequence to gaussian and then filter that. Note, since this is an indefinite length sequence, what you are really providing to the user is a subroutine which he can call to get the next sample of the band limited sequence. This is pretty few time cycled between the first call and the first sample. In IIR filter design is probably appropriate.

If the probability distribution is to be arbitrary, the problem is much much harder. But this isn't too likely to be what your user wants.

[ - ]

- its going to be definite length of samples,

- its not have to be fast cause samples are going to be calculated once at the beginning of the simulation,

- I dont care about probability function, I just need to have a noise which instantaneous power would be equal to 1W but its not a problem since it can be done using apropriate scaling.

Do you mean IFFT?

[ - ]

Marcin,

The most common approach is to take wide bandwidth white noise sequence and filter its bandwidth down to the desired bandwidth with a, IRR filter. That's actually not the best approach. What you want to do is generate the noise at the bandwidth you want with a low sample rate commensurate with the low bandwidth and then interpolate up with a resampling filter to the sample rate you want. See attached paper

fred h

SDR_Narrowband_Noise_2

[ - ]

[ - ]

Hello Mr Lyons!

Yeah thats true, I feel honored cause so many living legends wrote under my question, including you! Thank you all, problem was resolved using IFFT for that purpose!

Best regards,

Marcin

[ - ]

Hello Marcinstein.

Oh no no! I'm not in the same league as Charles Rader and fred harris.

Charles Rader, among his other accomplishments, is literally one of inventors of IIR digital filters. His seminal 1967 paper titled: "Digital Filter Design Techniques In the Frequency Domain" was ground-breaking. He was also the co-author of the very first DSP book ("Digital Processing of Signals"). To understand Charlie's influence on the world of DSP, have a look at:

fred harris (who holds the record for the most number of years teaching university-level DSP classes) must surely be the most prolific writer of DSP technical papers. I'll bet fred's influential and famous 1978 paper titled: "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform" is the most referenced paper EVER published in a signal process journal. fred is a recognized world leader in multirate signal processing and software defined radios. The thing I like about fred is that he builds systems--he knows which end of the soldering iron is hot.

[ - ]

Generate random noise then filter it off to the band limits you target.

In Ocatve I can use filter functions(fir1...filter) to generate random complex noise of any power level, design filter and filter the noise vector. Your problem would be to design a user defined filter which may vary...

[ - ]

Yeah! Thats was my idea also! I know that in Octave or Matlab there are plenty of usefull functions but as I mentioned, I need to write it in C/C++. Question is, how to generate proper filter factors?

[ - ]

That takes us to lower level filter design methods. Plenty around.

Windowed sinc example:

M = 39; %number of taps

Fc = .2; %cutoff relative to Fs of 1

x = linspace(-(M-1)/2,(M-1)/2,M);

h = ones(1,M);%default

i = find(x); %avoid division by zero

h(i) = sin(x(i)*2*pi*Fc)./(x(i)*2*pi*Fc);

%h = h .* hamming(M)'; %apply a window

h = h/sum(h);%dc power unity

[ - ]

Thanks!

What do you think about using FFT? By zeroing bins for each subcarries and put random complex numbers in place where noise has to occur?

[ - ]

yes that is ok if you afford ifft and then you don't need any filter (ifft stopband acts as filter) but is frame based and might suffer discontinuity between frames.

[ - ]

Discontinuity is not a problem, generated samples will act as a noise. I have already implemented this algorithm in Matlab. Works like a charm.

Thank you :)

Marcin

[ - ]

Hello Marcin:  If you do not have access to C/C++ libraries (like fft/ifft), the simplest method to generate a noise time series of length N, between frequencies fa and fb, is to sum up a bunch of random magnitude cosines and sines between lying between fa and fb, in the time domain..    You can make it 'more noisy' by randomising both amplitudes and phases.

[ - ]

That doesn't make any sense at all, and sounds very indefinite. Unless you did this with a very large number of components, you'd have a spectrum that is characterized by spikes.

The whole point of specifying noise precisely (in the power spectral density sense) is to ensure it has a certain frequency characteristic that cannot be predicted.

I guess if this is something that just looks/sounds "noise-like" to a person who isn't very discerning, then ok, sure, maybe. But the human ear/mind is surprisingly good at discerning frequency content. I'd be willing to bet a moderate amount of money that if I heard true noise with a uniform power spectral density over a certain band, and noise generated by the method you suggest, that I could discern the difference.

[ - ]