# fit theoretical spectrum to simulated one

I have a bunch of simulated time series, for which I can compute the power spectrum. Generally, the simulated power spectrum can be sketched as follows: I now aim to calculate the features of the theoretical power spectrum. The theoretical power spectrum can be represented by:

$$S_{th}=\frac{4\left(L/U_{hub}\right)}{\left(1+6f\left(L/U_{hub}\right)\right)^{5/3}}$$

where

$$L = constant\ length\ scale$$ $$U_{hub} = constant\ speed$$ $$f = frequency\ vector$$

Given Uhub and f (they are "environtmental variables"), the theoretical power spectrum will approach, within a certain tolerance, the simulated one only for a certain defined value of L. This procedure will lead to the following figure: Therefore, I am interested in developing a method which allows for the extrapolation of the right L value.

I have been thinking of using lsqcurvefit. Up to now I used it this way:

function p_theo = ps_th(x,f)
L = x(1);
Uhub = x(2);
exp = 5/3;
C = (L/Hub);
f_x = 6.*f.*C;
p_theo = 4*C./((1 + f_x).^exp);
end

lsqcurvefit(@ps_th,[330;Uhub],f,ps_sim)


But I am evidently using lsqcurvefit improperly, since only L is driving the optimization and Uhub must stay fixed.

Can anyone shed light on this problem?

• I'm not really sure what you're asking. Did it run and give you bad results? Did it provide an error? Note that optimizing for the right value of $L$ is equivalent to optimizing for the right value of $\frac{L}{U_{hub}}$ if $U_{hub}$ is a constant known a priori. So, you can instead solve for the optimal ratio instead, then calculate what $L$ would be. – Jason R Apr 8 '13 at 17:01
• can you average multiple spectra to get a closer approximation to start? – endolith Apr 10 '13 at 20:11
• @endolith: yes I can – fpe Apr 10 '13 at 20:15
• To restate @JasonR's point, in your equation, $L$ and $U_{hub}$ are not independent variables. Only $C$ is. – craigim Apr 10 '13 at 23:25
• I can't understand this program,can you send me full code of Power Spectrum Density. I want that my result should be look like above fig. So,please send me full code to my mail-id- bappa.ism@gmail.com Thanking you Bappa Mukherjee Student of Applied Geophysics. I.S.M. Dhanbad-826004. India. – user7593 Jan 18 '14 at 15:32