The code I have is based in Emil Brandt Kærgaard thesis (DTU), it is a Multidimensional Collocation Method using a Gauss-Legendre sparse grid, and is perfectly calculating the mean and variance as follows:

Either way, I don’t seem to be able to understand how to assemble the surrogate in this multivariate case, it is getting really hard to progress. I have been reading materials from Bruno Sudret (mainly Blaise Pascal monograph), the aforementioned thesis (DTU), and the book by Dongbin Xiu (numerical methods for stochastic computation).

Would you please suggest a beginner source for this matter, or even a tip? All comments are much appreciated!

Maybe you can be more specific about what you already have and what is missing and where exactly you are stuck.

And do I understand correctly that you are trying to implement PCE from scratch? Is there any reason to do this? There are powerful implementations (UQLab, but also many others) that are well tested and already offer very advanced state-of-the-art features.

I have previously used UQlab in some tests, it is indeed a wonderful tool. I am trying to implement my version of PCE so I can fully understand the method (which is very confuse in my opinion, especially the multivariate version).

To sum it up:

-a toy problem is solved in time domain by Newmark - 1gdl mass-spring-damper.

-the toy problem is evaluated with very specific sparse grid points as input (scaled to the input dimensions and uncertain interval).

-the resulting displacement signals, U, are then used to obtain the mean (xmean) and variance (xvar) of the displacement in each time step. ZW are the weights of the grid points, and AN is the total number of grid points:

I have tested this code against Monte Carlo Simulation in different problems, and it seems correct.

From this, I was trying to figure out how to build the surrogate PCE for a given time in the signal, so i can build the PDF. Can you confirm that this is done by means of the basis polynomials, in this case Legendre polynomials, U and ZW?

I will provide my matlab files bellow, in case you want to check out. This code was done based on Emil Brandt Kærgaard thesis (DTU), as mentioned previously. The files regarding the Gauss-Legendre sparse grid were downloaded from this link.

Thank you again for your reply, it is much appreciated.

I’m afraid I don’t understand exactly where you’re stuck. If your goal is to better understand PCE by implementing a basic version of it (which I think is a good idea), then I recommend using a simple case study (like this one: https://www.uqlab.com/uqlink-c-simply-supported-beam) and finding the coefficients using least squares. This is also something we let students start with to get familiar with surrogate modeling and PCE in particular. If it comes to your actual case study, I would then switch to a software of your choice offering a more sophisticated and versatile implementation of PCE.

If you feel that such a simple case study would be helpful, I can provide some sample code as a guidance.