1% STK_GENERATE_SAMPLEPATHS [overload STK function] 2 3% Copyright Notice 4% 5% Copyright (C) 2017, 2018 CentraleSupelec 6% 7% Author: Julien Bect <julien.bect@centralesupelec.fr> 8 9% Copying Permission Statement 10% 11% This file is part of 12% 13% STK: a Small (Matlab/Octave) Toolbox for Kriging 14% (http://sourceforge.net/projects/kriging) 15% 16% STK is free software: you can redistribute it and/or modify it under 17% the terms of the GNU General Public License as published by the Free 18% Software Foundation, either version 3 of the License, or (at your 19% option) any later version. 20% 21% STK is distributed in the hope that it will be useful, but WITHOUT 22% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 23% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 24% License for more details. 25% 26% You should have received a copy of the GNU General Public License 27% along with STK. If not, see <http://www.gnu.org/licenses/>. 28 29function zsim = stk_generate_samplepaths (model, varargin) 30 31switch nargin 32 33 case {0, 1} 34 stk_error ('Not enough input arguments.', 'NotEnoughInputArgs'); 35 36 case 2 37 % CALL: ZSIM = stk_generate_samplepaths (MODEL, XT) 38 xt = varargin{1}; 39 nb_paths = 1; 40 conditional = false; 41 42 case 3 43 % CALL: ZSIM = stk_generate_samplepaths (MODEL, XT, NB_PATHS) 44 xt = varargin{1}; 45 nb_paths = varargin{2}; 46 conditional = false; 47 48 case 4 49 % CALL: ZSIM = stk_generate_samplepaths (MODEL, XI, ZI, XT) 50 xi = varargin{1}; 51 zi = varargin{2}; 52 xt = varargin{3}; 53 nb_paths = 1; 54 conditional = true; 55 56 otherwise 57 % CALL: ZSIM = stk_generate_samplepaths (MODEL, XI, ZI, XT, NB_PATHS) 58 xi = varargin{1}; 59 zi = varargin{2}; 60 xt = varargin{3}; 61 nb_paths = varargin{4}; 62 conditional = true; 63 64end 65 66if ~ isa (model, 'stk_model_gpposterior') 67 stk_error ('Syntax error.', 'SyntaxError'); 68end 69 70if conditional 71 model = stk_model_update (model, xi, zi); 72end 73 74xi = stk_get_input_data (model); 75zi = stk_get_output_data (model); 76model = stk_get_prior_model (model); 77 78zsim = stk_generate_samplepaths (model, xi, zi, xt, nb_paths); 79 80end % function 81