# Noise Shape Digital Filter

My objective is to build a noise shape filter from a given transfer function (in one case) and from a given PSD (for another case). Checking my precedent questions you can see that this argument is keeping me busy by long time. You can check this for my first attempt. First, I have noticed that $$SD = \sqrt{PSD}$$ and not the amplitude spectral density. Secondly I have tried to use the simple approach of putting a white noise in a filter to get a shaped function. My questions are: Is what I used as source a real white noise? - I have used the simulink block: Band-Limited White Noise which asks for: Noise power, sample time, seed. I started filling by trial and error procedure to get an averega power spectral density of 1

   prop = 1;
sample = prop*0.1;
pwr_white = prop;                 % autotuning toperforme pwr == 1 unit^2/Hz
seed = randi([1 23341]);


Applying these parameters to the block in simulink and feeding the output of the Band_imited white noise block into an Averaging Power Spectral Density block, the average PSD value is $$\pi$$ times smaller than the Noise power pwr_white. This is exactly how should it works. So from this information I am supposing that my noise is actually with PSD = 1. I have tried a similar procedure in MALAB. Using wgn(t_sim/sample,1,0) I get compleatly different results. But var(wgn(t_sim/sample,1,0)) is 1 and var(band limited white noise) is 10. I don't know where I am wrong.

-Using $$H(s)$$ as filter will produce in continuos domain the right noise shape? Looking the aswer cited before, I think yes. - taking the simulated noise in continuous domain then I need to obtain the PSD (and then SD) to confront with the noise characteristic that I want to perform: I came up to the idea that my initial approach was wrong: I was trying to use a noise shape filter simulated in continous to compute than a welch approximation. In this approach I used the MATLAB function pwelch

for i =[1e-5, 1e-4, 1e-3, 1e-2, 1e-1 1]

f_range = linspace(i,i*10,1000)
[pxx_noise_t] = pwelch(noise_t,[],[],f_range);
loglog(f_range,sqrt(pxx_noise_t),'r','LineWidth',1.2)
hold on

end


The welch approximation is used here in a hamming window (as default) with 50% of overlapping. The f_range given as a vector enables the approximation to be done on the specified range of frequencies. The for cycle is used to put as many points as possible in the approximation, actually the code computes a number of length(i)-1 = 5 welch approximation each in a decade. Actually I am not sure of the division by $$2\pi$$ of the noise_t. I have some doubts about the unit of the PSD. Are as deaful in (unit/rad/s)^2?

However, the approach used seems to be not suitable for the welch approximation, or better, for the implementation of a noise shape filter. One main reason is that I am not working in a discrete domain. So I need to built a filter in discrete. This is something that I have never done before, but off course I have never used the pwelch either.

So I need this digital filter. But even if the basic idea of filter is the same for continuous and discrete domain, I need some help. Even in the definition of white gaussian noise (WGN). Actually, checking this answer and the comment I have noticed some problem in applying the approach used in continuos to the case in discrete. Now I am starting from understanding FIR and IIR filters but I am not sure which one I have to use and how shoul I convert my H(s) in z domain.