1

I'm trying to use interp2 where my five inputs are all 1 by n vectors. Is this possible? or do I need to enter them in mesh format?

Brian
  • 26,662
  • 52
  • 135
  • 170
  • 2
    See this SO question: http://stackoverflow.com/questions/1672176/how-do-i-generate-a-3-d-surface-from-isolines – yuk Oct 18 '10 at 04:20

1 Answers1

1

No, you need to use meshgrid to generate your two first input arguments (X,Y), just like in this example (provided in Matlab's documentation):

[X,Y] = meshgrid(-3:.25:3);
Z = peaks(X,Y);
[XI,YI] = meshgrid(-3:.125:3);
ZI = interp2(X,Y,Z,XI,YI);
mesh(X,Y,Z), hold, mesh(XI,YI,ZI+15)
hold off
axis([-3 3 -3 3 -5 20])

I hope it helps.

Greg
  • 6,038
  • 4
  • 22
  • 37