function ensemble0 = ENSEMBLE0_init(n1, n2) % function ens0 = ensemble0(tau, n1, n2); % % Reads in information from INIT.mat % % TAU scales the std. dev. of initial ensemble members. % N1 is the number of non-rotated initial ensemble members % N2 is the number of rotated initial ensemble members % N2 of each of 3 rotations. % ensemble size is n1 + 6*n2 % % Results saved in ENSEMBLE.MAT % global PARAMS TRU load INIT if(~exist('n1','var')); n1 = 82; end if(~exist('n2','var')); n2 = 3; end % Dimensions Nt = size(TRU,2); % Number of Time Steps Ns = size(TRU,1); % Number of Spatial Locations (m) % GENERATE ENSEMBLE % Rotation of indices for data perturbations rot(:,1) = (1:200)'; rot(:,2) = [[100,1:99],[200,101:199]]'; rot(:,3) = [[99:100,1:98],[199:200,101:198]]'; rot(:,4) = [[98:100,1:97],[198:200,101:197]]'; rot(:,5) = [[2:100,1],[102:200,101]]'; rot(:,6) = [[3:100,1:2],[103:200,101:102]]'; rot(:,7) = [[4:100,1:3],[104:200,101:103]]'; k = 1; for i = 1:7; if(i==1); for j = 1:n1; ensemble0(:,k) = TRU(:,1); k = k+1; end else for j = 1:n2 ensemble0(:,k) = TRU(rot(:,i),1); k = k+1; end end end Nens = size(ensemble0,2); ensemble0 = ensemble0 + tau*Omgc*randn(size(ensemble0)); %save INIT ensemble0 Nens -append; %clear rot i j k