MATLAB: How do you take a sample point about the surface that is randomly drawn between the mean and prediction intervals at that location

fitrgpnormrndpredictStatistics and Machine Learning Toolbox

Using "fitrgp" to fit a Gaussian process regression and using "predict" to get the predicted surface, how do you take a sample point about the surface that is randomly drawn between the mean and prediction intervals at that location?
Reproduction steps:
>> load(fullfile(matlabroot,'examples','stats','gprdata.mat'))
>> sigma0 = std(ytrain);
>> sigmaF0 = sigma0;
>> d = size(Xtrain,2);
>> sigmaM0 = 10*ones(d,1);
>> gprMdl = fitrgp(Xtrain,ytrain,'Basis','constant','FitMethod','exact',...
'PredictMethod','exact','KernelFunction','ardsquaredexponential',...
'KernelParameters',[sigmaM0;sigmaF0],'Sigma',sigma0,'Standardize',1);
>> for ii = 1:10,000
>> [ypred,ysd,yint] = predict(gprMdl,0.5*ones(1,6));
>> Y(ii) = ypred; % How do you make Y(ii) randomly drawn between the mean and prediction intervals at the location X = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
>> end

Best Answer

This can be done using the "normrnd" function. This will allow you to get a gaussian (normal) distribution about the mean, instead of just returning the mean at the sample point.
>> Y(ii) = normrnd(ypred,ysd);