Optimization Problem: Suggestions from the floor

2 views (last 30 days)
Im running MATLAB 2010B and have the optimization toolbox (but not the global optimization toolbox).
I am not sure if I can use interpn.m for my problem.
I have a dependant variable, stored in a 1xK vector. (R)
I have a number (lets say 5) of independant variables stored in seperate 1xK vectors. (L1, L2, L3..L5)
I also have 5 "current" observations for the independant variables. (va, vb, vc...)
I would like to use somekind of optimization/ lookup routine to find the likely value of the dependant variable, r_now.
r_now = myFunc(L1, L2, L3, L4, L5, R, va, vb, vc, vd, ve);
I thought interpn.m might work for myFunc, but I cant get it to. Does anyone have any experince with this function?
None of my variables are montonically increasing, or on a regular grid, and the relationship is quite rough, so I thought the spline option from interpn.m would be useful.
When I place a breakpoint at the start of vi = interpn(varargin) I see (using 3 independants):
varargin =
[8286x1 double] [8286x1 double] [8286x1 double] [8286x1 double] [0.5000] [0.5000] [0.5000] 'spline'
I get the error message
??? Error using ==> interpn at 155 Wrong number of input arguments or some dimension of V is less than 2.
If interpn.m is not a good approach, can anyone suggest one? It needs to be quick (i.e. not simulated annealing/ stochastic methods)

Accepted Answer

mathworks2011 on 19 Jan 2012
interpn.m assumes equally spaced data, as per ndgrid.m.
It does not support nonuniformly spaced data.
griddatan.m allows conversion from unequal to equally spaced data using linear interpolation or nearest neighbour.
Another way to approach such a problem is multi-dimensional kernel density estimation.

More Answers (1)

Walter Roberson
Walter Roberson on 3 Nov 2011
You would like to do a TriScatteredInterp except you would like it in 5 dimensions. Perhaps something similar might be possible, considering that there is a delaunayn function that can work in arbitrary (positive integer) dimension.
Ah, looks like griddatan does something on this line. See example at http://www.mathworks.com/products/matlab/demos.html?file=/products/demos/shipping/matlab/qhulldemo.html


Find more on Operating on Diagonal Matrices in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!