58 ec = kernels.config.ExpansionConfig;
59 ec.Prototype.Kernel= kernels.Wendland;
60 ec.StateConfig= kernels.config.WendlandConfig(
" G ",10,
" S ",2,
" Dim ",2);
69 Z = sin(X/2).*Y.^2+5*X+
Y;
75 alg = approx.algorithms.VKOGA;
78 alg.ExpConfig= this.
EC;
82 function kernels.KernelExpansionkexp =
compute() {
85 kexp = alg.computeApproximation(this.
atd);
99 xi = [
X(sel(1:n));
Y(sel(1:n))];
100 atd = data.ApproxTrainData(xi,[],[]);
109 h = this.
PM.nextPlot(
" fun ",
" Original response surface ",
" x_1 ",
" x_2 ");
110 surfl(h, this.
X, this.
Y, this.
Z);
117 h = this.
PM.nextPlot(
" fun_atd ",
" Original response surface with training data ",
" x ",
" f(x) ");
118 surf(h, this.
X, this.
Y, this.
Z);
121 xi = this.
atd.xi.toMemoryMatrix;
122 plot3(h,xi(1,:),xi(2,:),fxi,
" r. ");
127 h = this.
PM.nextPlot(
" traindata ",
" Training data ",
" x_1 ",
" x_2 ");
128 xi = this.
atd.xi.toMemoryMatrix;
129 plot3(h,xi(1,:),xi(2,:),fxi,
" r. ");
137 allxi = [this.
X(:) this.
Y(:)]^
t;
145 args = [
" EdgeColor ",
" interp ",
" FaceAlpha ",.2,
" EdgeColor ",
" none ",
" FaceColor ",
" red "];
153 fxi = zeros(size(this.
X));
156 fxiflat =
k.evaluate(allxi);
157 fxi =
reshape(fxiflat,size(this.
X,1),[]);
159 if isa(pm,
" PlotManager ")
160 h = pm.nextPlot(sprintf(
" iter%d ",s),...
161 sprintf(
" Approximation at step %d ",s),
" x_1 ",
" x_2 ");
166 surf(h, this.
X, this.
Y, fxi,
" EdgeColor ",
" interp ");
169 surf(h, this.
X, this.
Y, this.
Z,args[:]);
171 plot3(allxi(1,centerpos(s)),allxi(2,centerpos(s)),...
172 fxiflat(1,centerpos(s)),
" y* ",
" MarkerSize ",20);
173 plot3(allxi(1,centerpos(s)),allxi(2,centerpos(s)),...
174 fxiflat(1,centerpos(s)),
" k. ",
" MarkerSize ",20);
176 plot3(allxi(1,centerpos(1:s-1)),allxi(2,centerpos(1:s-1)),...
177 fxiflat(1,centerpos(1:s-1)),
" r. ",
" MarkerSize ",16);
188 zlim =
get(h,
" ZLim ");
190 set(h,
" ZLim ",zlim);
205 rsa = demos.ResponseSurfaceApprox;
207 rsa.iterationPlots(kexp);
Collection of generally useful functions.
static function run()
This demo shows how the VKOGA algorithm approximates a 2D-1D response surface for different kernel co...
function Z = getSurface(X, Y)
static function idx = findVecInMatrix(A, b)
Finds column vectors inside a matrix.
function subexp = getSubExpansion(arg)
function plotOriginalWithTD()
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
This demo shows how the VKOGA algorithm approximates a 2D-1D response surface for different kernel co...
function alg = setupVKOGA()
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
Matlab's base handle class (documentation generation substitute)
function kernels.KernelExpansion kexp = compute()
function iterationPlots(kernels.KernelExpansion kexp, pm)
struct Centers
The kernel centers used in the approximation.
KernelExpansion: Base class for state-space kernel expansions.