I have a function which takes six variables and gives a single numerical value, newfn(a,b,c,d,e,f,), although most will only take a small range of values, and want to create a grid where I vary these variables and then be able to interpolate values between the grid. As I understand it I need to make the grid for reference data first, for the sake of quick computation say it is something like:
[alist,blist,clist,dlist,elist,flist]=ndgrid([1:2:10],[0.1:0.1:0.5],[0,2],[1.1,1.2,1.3],[10,20,30],3);
then find the reference values:
refdata=newfn(alist,blist,clist,dlist,elist,flist)
then suppose our grid of values to interpolate to is given by
[nag,nbg,ncg,ndg,neg,nfg]=ndgrid([1:10],[0.1:0.1:0.5],[0:2],[1.1,1.2,1.3],[10,15,20,25,30],3);
Then I thought I'd be able to use griddatan like this:
intrpldata=griddatan([ag,bg,cg,dg,eg,fg],refdata,[nag,nbg,ncg,ndg,neg,nfg])
but this isn't working, so I'm going badly wrong somewhere?
Best Answer