Prev: How to find a particular pattern in an image for a range of
Next: How to hide a created script or function?
From: Nirav on 28 Jul 2010 11:31 Dear Friends, If rows = [ 1 2 3]; columns = [1 2 3]; table = [ 10 20 30; 100 200 300; 1000 2000 3000]; Than the output of interp2(rows,columns,table,2.5,2.5) = 1375? How is this calculated? I thought it would be : (2,2) + (2,2.5) + (2.5,2) = 200+1100+250 = 1350 !!! But it doesnt seem to be like that. Can anybody please help me understand this interpolation fundamentals? Thanks, Nirav
From: Greg Heath on 28 Jul 2010 21:43 On Jul 28, 11:31 am, "Nirav" <npsc...(a)yahoo.com> wrote: > Dear Friends, > If rows = [ 1 2 3]; > columns = [1 2 3]; > table = [ 10 20 30; 100 200 300; 1000 2000 3000]; > Than the output of interp2(rows,columns,table,2.5,2.5) = 1375? > How is this calculated? > I thought it would be : (2,2) + (2,2.5) + (2.5,2) = 200+1100+250 = 1350 !!! > But it doesnt seem to be like that. > Can anybody please help me understand this interpolation fundamentals? I don't know interp2. However, just looking at the table I would guess ((2,2.5)+(2.5,2)+(2.5,3)+(3,2.5)) = 1375. Hope this helps. Greg
From: Greg Heath on 29 Jul 2010 07:20 On Jul 28, 9:43 pm, Greg Heath <he...(a)alumni.brown.edu> wrote: > On Jul 28, 11:31 am, "Nirav" <npsc...(a)yahoo.com> wrote: > > > Dear Friends, > > If rows = [ 1 2 3]; > > columns = [1 2 3]; > > table = [ 10 20 30; 100 200 300; 1000 2000 3000]; > > Than the output of interp2(rows,columns,table,2.5,2.5) = 1375? > > How is this calculated? > > I thought it would be : (2,2) + (2,2.5) + (2.5,2) = 200+1100+250 = 1350 !!! > > But it doesnt seem to be like that. > > Can anybody please help me understand this interpolation fundamentals? > > I don't know interp2. However, just looking at the > table I would guess > > ((2,2.5)+(2.5,2)+(2.5,3)+(3,2.5)) = 1375. Correction: For bilinear interpolation ans = ((2,2.5)+(2.5,2)+(2.5,3)+(3,2.5))/4 = (250 + 1100 + 1650 + 2500)/4 = 1375 However linear interpolation might be more accurate if you used linear interpolation on the log of the table entries. Hope this helps. Greg
From: John D'Errico on 29 Jul 2010 08:04
Greg Heath <heath(a)alumni.brown.edu> wrote in message <f97cf485-3d12-4597-bd9b-4fb692e51c6c(a)c10g2000yqi.googlegroups.com>... > On Jul 28, 9:43 pm, Greg Heath <he...(a)alumni.brown.edu> wrote: > > On Jul 28, 11:31 am, "Nirav" <npsc...(a)yahoo.com> wrote: > > > > > Dear Friends, > > > If rows = [ 1 2 3]; > > > columns = [1 2 3]; > > > table = [ 10 20 30; 100 200 300; 1000 2000 3000]; > > > Than the output of interp2(rows,columns,table,2.5,2.5) = 1375? > > > How is this calculated? > > > I thought it would be : (2,2) + (2,2.5) + (2.5,2) = 200+1100+250 = 1350 !!! > > > But it doesnt seem to be like that. > > > Can anybody please help me understand this interpolation fundamentals? > > > > I don't know interp2. However, just looking at the > > table I would guess > > > > ((2,2.5)+(2.5,2)+(2.5,3)+(3,2.5)) = 1375. > > Correction: For bilinear interpolation > > ans = ((2,2.5)+(2.5,2)+(2.5,3)+(3,2.5))/4 > = (250 + 1100 + 1650 + 2500)/4 > = 1375 > > However linear interpolation might be > more accurate if you used linear interpolation > on the log of the table entries. > Yes, by default, interp2 uses bilinear interpolation. At the center of a cell, the result is merely the average of the 4 nodes that bound the rectangular cell. Thus 1375 = (200 + 300 + 2000 + 3000)/4 HTH, John |