User`s guide
Mathematics
4-17
Functionality What Happens When
You Use This Functionality
Use This Instead Compatibility
Considerations
Passing mixed-
orientation vectors to
interpn:
interpn(x1,x2,...,xn,
V,
x1q,x2q,...,xnq)
Specifically, if one or
both of the following
are true:
• x1,x2,...,xn are
a combination of
row and column
vectors.
• x1q,x2q,...,xnq
are a combination
of row and column
vectors.
Still Runs Construct the full grid
with ndgrid first.
Alternatively, use
griddedInterpolant
if you have a large data
set.
Modify all instances
that pass mixed-
orientation vectors
to interpn. You can
modify your code in one
of two ways:
• Call ndgrid to
construct the full
grid first.
[X1,X2,...,Xn]
= ndgrid(x1,
x2, ..., xn);
[X1q,X2q,...,Xnq]
= ndgrid(x1q,
x2q, ..., xnq);
Vq =
interpn(X1,
X2, ..., Xn, V,
X1q, X2q, ...,
Xnq);
• Pass the vectors to
griddedInterpolant
inside a cell array.
F=
griddedInterpolant({x1,
x2, ..., xn},
V);
Vq= F({x1q,
x2q, ...,
xnq});
interp1(...,
'cubic')
Warns interp1(...,
'pchip')
Replace all instances
of interp1(...,
'cubic') with
interp1(...,
'pchip')