# Generation of Noise-shape filter from Power Spectrum Density

This is my very first time in dealing with signal processing, so I am sorry if I will not use a rigorous terminology.

I am dealing with some issues about noise modeling in matlab. I'm trying to figure out a way to construct a model (filter) of a noise from data. My first problem is that I have no $$S_{xx}(f)$$ of the disturbances but only experimental data.

I have plots of the particular requirement with other noises characteristics in a differencial (or stray) acceleration $$(m/s^{2})/\sqrt{Hz}$$ vs frequency $$Hz$$.

I am wondering how can I get a spectrum from those disturbances and then use it to recreate the noise effect of the disturbances in matlab.

Edit:

After some research, I have some question: I am oriented to design a noise-shape filter to introduce disturbances in the model. But my problem still remains: How can I be sure that the noise produced by the filter will generate a PSD coherent with the one that I have in my data?

I am refering to something like this for basic use in MATLAB. But these are old notes and the writer uses old versions of MATLAB functions (as psd) and I don't know how to apply it to my case. I found this for a more detailed and complex procedure, but even here I don't know how to use it properly.

I forgot to present this alternative: fftnoise which seems to do exactly what I need

EDIT Given the interpolation of the ASD (amplitude spectral density) (which is $$\sqrt{PSD}$$ how can I get the H(f) of the filter? I am not sure how the use of prony and frd (system identification toolbox)

% points
x = ([0.1 0.12 0.2 0.24 0.4 1 2 3].*1e-3);
y = ([150 100 40 30 20 13 12 12].*1e-15);
xlog = log10(x);
ylog = log10(y);
% fitting
N = 1000;
pp = polyfit(xlog,ylog,3);
freq_log = linspace(xlog(1),xlog(end),N);
CAPACT_sensing_ASD_log = polyval(pp,freq_log);
CAPACT_sensing_ASD = 10.^CAPACT_sensing_ASD_log;
freq = 10.^freq_log;

% ESTIMATION
impulse_resp = ifft(CAPACT_sensing_ASD);
f = logspace(-4,-1,N);
phases=rand(1,N);
phases = 0; %(phases-median(phases))*2*pi;
% phases=complex(cos(phases),sin(phases));
response = impulse_resp.*exp(1j*phases*pi/180);
h = idfrd(response,f,1);
data = frd(h,frequency,'FrequencyUnit','Hz');   % object asked by frd! Am I doing it right?
H_CAP_est = tfest(data,3,2);
Num_est = H_CAP_est.Numerator;
Den_est = H_CAP_est.Denominator;
% PRONY
denom_order = 3;
num_order = 2;
[Num_pro,Den_pro] = prony(real(ifft(response)),num_order,denom_order);
s = tf('s');
H_CAP_prony = tf(Num_pro,Den_pro);

• take the square root of $S_{xx}(f)$ to get $|H(f)|$, the magnitude response of a hypothetical filter and use the tools from MATLAB (perhaps prony()) to design a filter that well matches $|H(f)|$. to filter white noise (where $S_{ww}(f)=1$ and which comes outa a decent random number generator) to get your $S_{xx}(f)$, that $H(f)$ will do it and you need not care about the phase response of $H(f)$. Oct 10 '18 at 20:48
• I noticed you've made substantial progress on this yourself (reading several of your edits by clicking "edited" to the left of your user name/image). Congratulations! It is always okay to answer your own question in Stack Exchange. This benefits figure readers who find your question in a search and then see that it has an accepted answer. Answers get 10 reputation points per up vote, and once you reach 50 you can start leaving comments, so everybody wins!
– uhoh
Oct 13 '18 at 2:17