From: Leyen on 22 Jul 2010 20:19 Hi I am using triscatteredinterp with an x,y,z array where z is not an explicit function of x and y. I then use meshgrid to generate points of interest and feed this to the function F created by triscatteredinterp. The output matrix has the first and last columns as NaN, and the first few rows are also NaN. The rest of the output computed correctly. Given that z is 0 at x =0, why is triscatteredinterp not computing this correctly? Thanks for any help.
From: Steven_Lord on 23 Jul 2010 09:50 "Leyen " <lschang(a)stanford.edu> wrote in message news:i2an5n$1fu$1(a)fred.mathworks.com... > Hi I am using triscatteredinterp with an x,y,z array where z is not an > explicit function of x and y. > I then use meshgrid to generate points of interest and feed this to the > function F created by triscatteredinterp. > > The output matrix has the first and last columns as NaN, and the first few > rows are also NaN. The rest of the output computed correctly. Given that > z is 0 at x =0, why is triscatteredinterp not computing this correctly? It likely IS computing the result correctly. TRISCATTEREDINTERP does NOT extrapolate outside the convex hull of the data with which you construct it. As a simpler example: T = TriScatteredInterp([0; 1; 1; 0], [0; 0; 1; 1], [1; 2; 4; 3]); This will be able to interpolate inside the square bounded by the four lines x = 0, x = 1, y = 0, and y = 1. If you try to evaluate it inside that square: >> T(0.5, 0.5) ans = 2.5000 If you try to evaluate it _outside_ that square: >> T(1.5, 0.5) ans = NaN -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Leyen on 23 Jul 2010 12:13 Steve, I did check that the points I'm querying are not outside the coordinates used as inputs to Triscatteredinterp. The input x is [0:7.36] and the input Y is [1.4:1.44]. All the point I query are within this grid. It seems that the function is having trouble computing values that fall on the boundaries of the grid. Thanks for any further assistance. Leyen
|
Pages: 1 Prev: Creating a binary mask using imfreehand Next: Reading Non-Rectangular Text File |