Failed to execute an example with creation of a random field

Hello -
I was trying to execute the example given in the UQLab-doc User Manual section 2.1.3, which failed as follows.
I am using MATLAB R2022a on MS Windows 11.
Can anyone help to solve this problem?
Thanks,
Vincent

uqlab
Copyright 2013-2022, Stefano Marelli and Bruno Sudret, all rights reserved.
This is UQLab, version 2.0
UQLab is distributed under the BSD 3-clause open source license available at:
D:\coding\UQLab_Rel2.0.0\LICENSE.

To request special permissions, please contact:

  • Stefano Marelli (marelli@ibk.baug.ethz.ch).

Useful commands to get started with UQLab:
uqlab -doc - Access the available documentation
uqlab -help - Additional help on how to get started with UQLab
uq_citation help - Information on how to cite UQLab in publications
uqlab -license - Display UQLab license information

RFInput.Type = ‘RandomField’;
RFInput.Corr.Family = ‘Gaussian’;
RFInput.Corr.Length = 0.2;
RFInput.Mean=1;
RFInput.Std=1;
RFInput.Mesh= linspace(-1,1,200)';
myRF = uq_createInput(RFInput);
Error using uq_eval_Kernel
Undefined function ‘pdist2’ for input arguments of type ‘double’.

Error in uq_EOLE (line 49)
RF.EOLE.Corr = uq_eval_Kernel(Coor, Coor, Corr.Length, Corr) ;

Error in uq_createRF (line 154)
RF = uq_EOLE(Coor, Mesh, Corr, ExpOrder, EnergyRatio, Data) ;

Error in uq_initialize_uq_randomfield (line 732)
current_input.Internal.RF = uq_createRF(current_input);

Error in uq_core_module/run_initialization_script (line 208)
initHandle(obj);

Error in uq_core_input/add_module (line 95)
success = this.run_initialization_script(obj);

Error in uq_createInput (line 114)
eval(str);

Dear @Vincent_Wu

The error message says that MATLAB cannot find the function ‘pdist2’. This function is part of the Statistics and Machine Learning Toolbox. Do you have this toolbox installed?

Best regards
Styfen

Hi @styfen.schaer
Thanks for the solution. I thought I installed Statistics and Machine Learning Toolbox and It turned out I did not. The UQLab is running now.
Thanks,
Vincent