Creates Gaussian process simulations based on given covariance and mean information.
Y=simGaussian(X,fcov,theta); Y=simGaussian(X,fcov,theta [, noise ,trendf,trendCoef,sigma,ns]);
data points for simulation (m*n matrix, m - number of points, n - number of dimensions, each row represents one point)
pointer to correlation function. Use fcov= 'gaussian', Gaussian correlation; fcov= 'matern_5_2', for Matern 5_2 correlation function;...
row array (1*n) of scaling hyper-parameter vaules.
scalar, variance of noise effect. If not given or noise ==0, assumes no noise.
pointer to trend function. This function should return 1*p trend coefficients;
column vector (p*1) of trend coefficients. If zero trend needed use trendf=0 and trendCoef=0.If not given assumes zero trend (trendCoef=0; trendf=poly0;).
scalar, total process variance, if not given assumes sigma=1;
number of simulations, if not given assumes ns=1;
matrix of simulations (m*ns).
Creates ns Gaussian process simulations at data points X based on given covariance and mean information.
// 1D simulation // zero trend Xtest=(linspace(-1,1,100))'; Y=simGaussian(Xtest,'gaussian',0.3,%eps*100,ns=10 ); scf; plot(Xtest,Y) // linear trend Y=simGaussian(Xtest,'gaussian',0.2,%eps*100,1,[5 ;3],ns=10 ); scf; plot(Xtest,Y) //sin trend Xtest=(linspace(-1,3,100))'; Y=simGaussian(Xtest,'gaussian',0.2,%eps*100,sin,[0.5],0.005,ns=5 ); scf; plot(Xtest,Y); Y=simGaussian(Xtest,'gaussian',1,%eps*100,ns=10 ); plot(Xtest,Y) // 2D simulation nx=20; //size of mesh, size of covariance matrix = n^2*n^2!!! // simulate 2D X1=(linspace(-1,1,nx)); X2=(linspace(-2,2,nx))'; // creates point matrix for simulation X=[X1; ones(X1)]'.*.[ones(X2) X2]; Y=simGaussian([X(:,1) X(:,$)],'gaussian',[1 0.7],%eps*10000); // splits Y to Z for ploting Z=[]; for i=1 :nx Z=[Z; Y((i-1)*nx+1:(i)*nx)']; end; scf; mesh(X1,X2,Z); | ![]() | ![]() |