22 basedir = fileparts(mfilename(
" fullpath "));
24 file = fullfile(basedir,
" paramdomaindetection_withnoise.mat ");
30 ax = pm.nextPlot(
" raw_data ",
" Frequencies by detector ",
" Fibre type \tau ",
" Mean current \kappa ");
31 tri = delaunay(ps(1,:),ps(2,:));
32 trisurf(tri,ps(1,:),ps(2,:),Hz,
" Parent ",ax,
" FaceColor ",
" interp ",
" EdgeColor ",
" interp ");
38 ft = linspace(m(1),M(1),n);
39 mc = linspace(m(2),M(2),n);
40 [FT,MC] = meshgrid(ft,mc);
41 HZ = griddata(ps(1,:),ps(2,:),Hz,FT,MC,
" nearest ");
45 stencil = [0 0 1 0 0; 0 1 1 1 0; 1 1 1 1 1; 0 1 1 1 0; 0 0 1 0 0];
48 stencil = stencil/sum(stencil(:));
49 HZ = padarray(HZ,[padsize padsize],
" replicate ");
52 HZ = conv2(HZ,stencil,
" same ");
54 HZ = HZ(padsize+1:end-padsize,padsize+1:end-padsize);
55 ax2 = pm.nextPlot(
" smoothed ",
" Smoothed frequency surface ",
" Fibre type \tau ",
" Mean current \kappa ");
56 surf(ax2,FT,MC,HZ,
" FaceColor ",
" interp ",
" EdgeColor ",
" interp ");
60 s = load(fullfile(basedir,
" ../ ",
" upperlimitpoly.mat "));
61 maxv =
polyval(s.upperlimit_poly,FT);
63 atd = data.ApproxTrainData([FT(valid) MC(valid)]^
t,[],[]);
67 alg = approx.algorithms.VKOGA;
68 ec = kernels.config.ExpansionConfig;
70 sc = kernels.config.WendlandConfig(
" G ",comb(1,:),
" S ",comb(2,:));
73 alg.MaxExpansionSize= 1000;
76 kexp = alg.computeApproximation(atd);
79 afx = kexp.evaluate([FT(:) MC(:)]^t);
80 FX = reshape(afx,200,[]);
82 ax3 = pm.nextPlot(
" approx ",
" Learned smoothed frequency surface ",
" Fibre type \tau ",
" Mean current \kappa ");
83 surf(ax3,FT,MC,FX,
" FaceColor ",
" interp ",
" EdgeColor ",
" interp ");
87 pm.UseFileTypeFolders=
false;
89 pm.FilePrefix=
" freq ";
90 pm.NoTitlesOnSave=
true;
93 pm.savePlots(basedir,
" Format ",
" jpg ",
" Close ",
true);
94 file = fullfile(basedir,
" FreqencyLearning.mat ");
95 save(file,
" alg ",
" atd ",
" HZ ",
" FT ",
" MC ",
" valid ");
96 file = fullfile(basedir,
" FrequencyKexp.mat ");
Collection of generally useful functions.
static function comb = createCombinations(ranges, varargin)
Creates the cartesian product of the vectors passed as a matrix containing elements of each vector pe...
rowvec< double > FigureSize
The figure size for each newly created figure. Set to [] to use system default.
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
function FrequencyLearning()