This is my first attempt to write the covariance function. I have following values,
x = [-1.50 -1.0 -.75 -.40 -.25 0.00];
sf = 1.27;
ell = 1;
sn = 0.3;
The formula for squared exponential covariance function is
The matlab code for that I have written as :
K = sf^2*exp(-0.5*(squareform(pdist(x)).^2)/ell^2)+(sn)^2*eye(Ntr,Ntr);
where sf
is the signal standard deviation, ell
the characteristic length scale, sn
the noise standard deviation and Ntr
the length of the training input data x
.
But this giving me no result. Is there is any mistake in my coding ?
And once I calculate, I want to summarize into matrix form as shown below ,
Any help please ?
if x_ = 0.2
then how we can calculate :
a) K_ =[k(x_,x1) k(x_,x2)..........k(x_,xn)]
and
b) K__ = k(x_,x_)
Using matlab ?