UQWorld

How to perform Monte Carlo simulationbased on built PCE to get histogram and confidence interval of output?

Greeting,the PCE is bulit,then how to perform Monte Carlo simulation based on PCE model to get histogram of output,and store output to print it?

As I have not find the Monte Carlo simulation in PCE tutorial…

PCE is for stochastic system,then if input X is known,then how to compute output Y?

Dear AmosJoseph

You can find an example on how to estimate statistical moments using PCE here:

Best regards,
Styfen

Many thanks for your help!

Once the PCE is bulit,we can get statistical moments.

But I ask how to perform Monte Carlo simulation based on the bulit PCE model to get histogram of output,and store the sampling output of Monte Carlo simulation.

Dear AmosJoseph

It’s in fact so straightforward that there is no example on this. We should add it!

Using the example mentioned by @styfen.schaer , once your PCE is built you use the following code:

N_MCS = 10000 ;                  % size of your sample for histogram
XX = uq_getSample(N_MCS);        % sample the inputs from myInput
YY  = uq_evalModel(myPCE,XX);    % evaluate the PCE on the XX sample 
hist(YY)        

Best regards
Bruno

OK. Thanks for your help!

“”"
myPCE = uq_createModel(MetaOpts);

X = uq_getSample(1e6,‘MC’);
Y = uq_evalModel(myPCE,X);

uq_figure
uq_histogram(Y)
xlabel(’\mathrm Y’)
ylabel(‘Frequency’)
“”"

histogram

Pardon,I get the Frequency histogram, but the vertical axis is not decimal.
Why?

Dear AmosJoseph,

You simply have to normalize your histogram as explained and demonstrated here:

https://ch.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.histogram.html

h = histogram(x,'Normalization','probability')

Best regards,
Styfen

Many thanks for your help and advice!