Home > matutils > interf > realize.m

realize

PURPOSE ^

ft=realize(ad,rb,ps,r)

SYNOPSIS ^

function ft=realize(ad,rb,ps,r)

DESCRIPTION ^

 ft=realize(ad,rb,ps,r)

 Apply radial envelope ps to the provided array r
 
 r is an array of complex random numbers which have
 unit power spectrum and whose Fourier transform is purely real.
 eg: r=randn_ft_of_real(8)

 Twin function is powspec which goes the other way.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ft=realize(ad,rb,ps,r)
0002 % ft=realize(ad,rb,ps,r)
0003 %
0004 % Apply radial envelope ps to the provided array r
0005 %
0006 % r is an array of complex random numbers which have
0007 % unit power spectrum and whose Fourier transform is purely real.
0008 % eg: r=randn_ft_of_real(8)
0009 %
0010 % Twin function is powspec which goes the other way.
0011 
0012 % Take the sqrt to convert from power to amplitude
0013 amp=sqrt(ps);
0014 
0015 % Interpolate the 1D ps onto the 2D ft grid
0016 e=interp1(rb,amp,ad.u_r(:));
0017 e=reshape(e,size(ad.u_r));
0018 
0019 % Get rid of NaN's which can occur in interp
0020 e(~finite(e))=0;
0021 
0022 % Apply envelope. Now the array has power spectrum ps
0023 ft=r.*e;
0024 return

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005