User`s guide
Mathematics
7-13
Functionality What Happens
When You
Use This
Functionality
Use This Instead Compatibility Considerations
Passing mixed
orientation vectors to
interp2:
Vq = interp2(x, y,
V, xq, yq)
Specifically, if one or
both of the following
are true:
• One of x and y is a
row vector and the
other is a column
vector.
• One of xq and yq is
a row vector and the
other is a column
vector.
Still Runs Construct the full grid
with meshgrid first.
Alternatively, use
griddedInterpolant if you
have a large data set.
Modify all instances that
pass mixed orientation
vectors to interp2. You
can modify your code in one
of two ways:
• Call meshgrid to
construct the full grid
first.
[X,Y] = meshgrid(x,
y);
[Xq,Yq] =
meshgrid(xq, yq);
Vq = interp2(X, Y,
V, Xq, Yq);
• Pass the vectors to
griddedInterpolant
inside a cell array.
F =
griddedInterpolant({x,
y}, V.');
Vq = (F({xq,
yq})).'