image thumbnail
from Surrogate time series and fields by V. Venema
Algorithms to calculate 1D, 2D and 3D fields with your specified power spectrum and distribution.

remove_average_profile(lwc, mean_pdf_profile)
function lwc = remove_average_profile(lwc, mean_pdf_profile)

len=length(mean_pdf_profile);

a=size(lwc);
no_dim = length(a);

if (no_dim == 2)
    for i=1:len
        lwc(i,:)=lwc(i,:)-mean_pdf_profile(i); % indexes are for y, x
    end
end

if no_dim == 3
    for i=1:len
        lwc(:,:,i)=lwc(:,:,i)-mean_pdf_profile(i); % indeces here are x, y, z      
    end
end

Contact us at files@mathworks.com