Home > atmlab > randomize > iaaft > surrogate_2d_3d.m

surrogate_2d_3d

PURPOSE ^

surrogate_2d_3d

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 surrogate_2d_3d

 This is the main program of the Iterative Amplitude Adapted Fourier
 Transform  (IAAFT) method to make surrogate fields. This version makes 3D
 fields based on the statistical properties of 2D fields. The amplitude distribution
 is supposed to be valid for the entire field (no vertical anisotropy).

 The IAAFT method was developped by Schreiber and Schmitz (see e.g. Phys. 
 Rev Lett. 77, pp. 635-, 1996) for statistical non-linearity tests for time series.
 This method makes fields that have a specified amplitude distribution and
 power spectral coefficients. It works by iteratively adaptation the amplitude 
 distribution and the Fourier coefficients (the phases are not changed in this 
 step). Do not use this program without understanding the function
 iaaft_loop_2d_horizontal and tuning its variables to your needs.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

surrogate_2d_3d.m

SOURCE CODE ^

0001 % surrogate_2d_3d
0002 %
0003 % This is the main program of the Iterative Amplitude Adapted Fourier
0004 % Transform  (IAAFT) method to make surrogate fields. This version makes 3D
0005 % fields based on the statistical properties of 2D fields. The amplitude distribution
0006 % is supposed to be valid for the entire field (no vertical anisotropy).
0007 %
0008 % The IAAFT method was developped by Schreiber and Schmitz (see e.g. Phys.
0009 % Rev Lett. 77, pp. 635-, 1996) for statistical non-linearity tests for time series.
0010 % This method makes fields that have a specified amplitude distribution and
0011 % power spectral coefficients. It works by iteratively adaptation the amplitude
0012 % distribution and the Fourier coefficients (the phases are not changed in this
0013 % step). Do not use this program without understanding the function
0014 % iaaft_loop_2d_horizontal and tuning its variables to your needs.
0015 
0016 % This Matlab version was written by Victor Venema,
0017 % Victor.Venema@uni-bonn.de, http:\\www.meteo.uni-bonn.de\victor, or
0018 % http:\\www.meteo.uni-bonn.de\victor\themes\surrogates\
0019 % for the generation of surrogate cloud fields.
0020 % First version: May 2003.
0021 % This version:  November 2003.
0022 
0023 % Copyright (C) 2003 Victor Venema
0024 % This program is free software; you can redistribute it and/or
0025 % modify it under the terms of the GNU General Public License
0026 % as published by the Free Software Foundation; version 2
0027 % of the License.
0028 %
0029 % This program is distributed in the hope that it will be useful,
0030 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0031 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0032 % GNU General Public License for more details.
0033 %
0034 % To get a copy of the GNU General Public License look on internet
0035 % or write to the Free Software Foundation, Inc., 59 Temple Place -
0036 % Suite 330, Boston, MA  02111-1307, USA.
0037 
0038 % Load data.
0039 %[fourier_coeff_2d, sorted_values_prof, x, y, template, mean_pdf_profile, no_values_x, no_values_y] = load_2d_data_vertical(1);
0040 
0041 % Enlarge the vector with the sorted values to the number of points of
0042 % the 3D field.
0043 no_values_z = no_values_y;
0044 no_values_y = no_values_x;
0045 sorted_values2 = zeros(no_values_x, no_values_y, no_values_z);
0046 for t = 1:no_values_x
0047     sorted_values2(t, :, :)=sorted_values_prof;
0048 end
0049 sorted_values_prof = reshape(sorted_values2, no_values_x*no_values_y, no_values_z);
0050 clear sorted_values2
0051 total_variance_pdf = std(sorted_values_prof(:)).^2;
0052 
0053 % Calculate the 3D Fourier spectrum assuming anisotropy
0054 coeff_3d = fourier_coeff_isotrop(fourier_coeff_2d');
0055 clear fourier_coeff_2d
0056     
0057 % Scale the total variance to the power spectrum to the variance of the
0058 % amplitude distributon.
0059 coeff_3d = coeff_3d.^2;
0060 total_variance_spec = sum(sum(sum(coeff_3d)));
0061 coeff_3d = coeff_3d * total_variance_pdf / total_variance_spec;
0062 coeff_3d = sqrt(coeff_3d);
0063 
0064 % Main iterative loop for 23-surrogates
0065 [surrogate, error_amplitude, error_spec] = iaaft_loop_3d(coeff_3d, sorted_values_prof);
0066 template  = remove_average_profile(template, -mean_pdf_profile);    % Add the mean profile to the 'template', to get the original measurement
0067 surrogate = remove_average_profile(surrogate, -mean_pdf_profile);   % Add the mean profile to the surrogate
0068 
0069 % plot results
0070 %plot_2d_surrogate(x, y, template,  'template')
0071 %plot_3d_surrogate(x, x, y, surrogate, 'surrogate')

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005