2024-11-14 11:13:07 +01:00
|
|
|
function [ret] = find_nk_fit(~,VParams)
|
2024-11-13 18:36:50 +01:00
|
|
|
|
|
|
|
Lz = 20;
|
|
|
|
Nz = 4000;
|
|
|
|
normfac = Lz/Nz;
|
|
|
|
|
|
|
|
z = linspace(-0.5*Lz,0.5*Lz-Lz/Nz,Nz);
|
|
|
|
dz = abs(z(2)-z(1));
|
|
|
|
Kmax = pi*Nz/Lz;
|
|
|
|
kz = linspace(-Kmax,Kmax,Nz+1);
|
|
|
|
kz = kz(1:end-1);
|
|
|
|
|
|
|
|
psiz = exp(-0.5*(abs(z)/VParams.ell).^VParams.nu);% VParams.nu
|
|
|
|
normz = sum(abs(psiz).^2)*dz;
|
|
|
|
psiz = psiz / sqrt(normz);
|
|
|
|
|
|
|
|
psik = fftn(psiz)*normfac/(sqrt(2*pi)); % fftshifted
|
|
|
|
nk = abs(psik).^2;
|
|
|
|
nk_forfit = ifftshift(nk);
|
|
|
|
|
|
|
|
f = fit(kz',nk_forfit','gauss1'); % f(x) = a1*exp(-((x-b1)/c1)^2)
|
|
|
|
|
2024-11-14 11:13:07 +01:00
|
|
|
ret.ell = VParams.ell;
|
|
|
|
ret.nu = VParams.nu;
|
|
|
|
ret.ell_eff = 1/f.c1;
|
2024-11-13 18:36:50 +01:00
|
|
|
end
|