# Producing Colored Noise from a given PSD Data

I need to estimate (extract/produce) the colored noise of a given PSD Data. I have the following procedure to get the desired results.

1. First of all I calculate the filter coefficiencts using firls command in MATLAB by implementing Helbert Transform firls(filter_order,norm_freq,signal,'hilbert'), the problem I face is to choose the right order for the filter, I am at the moment working with hit and trial method and rougly a value of around 400 is selected which fits quite well with the PSD curve.
2. Secondly the white noise is passed to this filter and further amplified with a power amp. PSD of the extracted noise is again calculted and matched with the input PSD.

I want to know if this way is alright or not, moreover for passing white noise through the filter I am using Simulink, is there a way not to use time varibales and directly calculate the colored noise. In other word if I have to get rid of Simulink block. I tried to work with lsim and I can get to colored noise but it's amplitude is lesser and I am not sure how can I amplify the output signal so that it matches the input PSD.

just a short flow:

INPUT PSD --> Filter Coefficient Calculated --> White Noise Passed Through Filter --> Colored Noise at a lower amplitude extracted --> Amplified --> PSD of Colored Noise Calculated --> INPUT PSD matched with OUTPUT PSD

-
So your question is if that is the right way to make colored noise, and how to not reduce the power of the colored noise? – Jim Clay Dec 11 '12 at 14:57
Hi Jim, That is my question. 1. How to choose the right filter order (optimal) adaptivly 2. If somehow the power is reduced anyways what are the ways to increase the power. – technik_duck Dec 11 '12 at 15:11
Why do you need to change the filter? Does the "coloring" that you need change with time? – Jim Clay Dec 11 '12 at 15:58
the input PSD data is changing for differnt applications. It will be part of a toolbox and everytime there will be a new data sample – technik_duck Dec 12 '12 at 18:29

1. Estimating the necessary filter order

There are methods for estimating the needed filter order for low/band/high-pass filters, but the fact that you are talking about "colored noise" suggests that you are not going for relatively simple frequency profiles. Thus, the answer is "no", I am not aware of an order estimator that will help you. The best generic advice I can give you is to go as high as you can stand performance-wise and hopefully that will be enough.

2. Filtered/Colored output has lower amplitude than input

It sounds like you know the frequency profile you want, and are creating a filter that produces that profile. If that is the case, fixing this should be easy. Do the following:

1. Calculate the average of the amplitude of the frequency profile you are creating.
2. Divide all of your filter coefficients by that average.

That should make the overall gain of the filter "1" with regards to white noise input.

-