clearvars
uqlab;

X = load('X.csv');
Y = load('Y.csv');

% Define input parameters


InputOpts.Marginals(1).Name = 'X1';
InputOpts.Marginals(1).Type = 'Gamma';
InputOpts.Marginals(1).Moments = [2.067 0.6772];


InputOpts.Marginals(2).Name = 'X2';
InputOpts.Marginals(2).Type = 'Uniform';
InputOpts.Marginals(2).Parameters = [5.68 6.72];


InputOpts.Marginals(3).Name = 'X3';
InputOpts.Marginals(3).Type = 'Uniform';
InputOpts.Marginals(3).Parameters = [9.28 46.72];

myInput = uq_createInput(InputOpts);


%Select PCE as the metamodeling tool

MetaOpts.Type = 'Metamodel';
MetaOpts.MetaType = 'PCE';

% Use input parameters
MetaOpts.ExpDesign.X = X
MetaOpts.ExpDesign.Y = Y

% Set the maximum polynomial degree to 5
MetaOpts.Degree = 1:5;

% Create the metamodel object and add it to UQLab
myPCE = uq_createModel(MetaOpts);

% Print a summary of the resulting PCE metamodel
uq_print(myPCE);

% Computing Sobol indices
SobolOpts.Type = 'Sensitivity';
SobolOpts.Method = 'Sobol';
SobolOpts.Sobol.Order = 1;
mySobol = uq_createAnalysis(SobolOpts);
uq_print(mySobol)         % print the Sobol' indices
uq_display(mySobol)       % display the Sobol' indices


































