I'm trying to use interp2 where my five inputs are all 1 by n vectors. 开发者_如何学PythonIs this possible? or do I need to enter them in mesh format?
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.
精彩评论