How to use 3D interpolation in matlab script?

2 views (last 30 days)
The code is as follows:
cylinder_1=[2,8];
speed=[0,800,1000];
power=[1,137,155];
Values(:,:,1)=[0,0,0;0,2,8];
Values(:,:,137)=[0,0,0;0,-4,0];
Values(:,:,155)=[0,0,0;0,0,-7];
[X,Y,Z]=meshgrid(speed,cylinder,power);
V=interp3(X,Y,Z,Values,2,800,137);
When I use interp3 function, I get the following error message:
Error using griddedInterpolant The grid was created from grid vectors that were not strictly monotonic increasing.
Error in interp3 (line 142) F = griddedInterpolant(X, Y, Z, V, method,extrap);
When I use the command "griddedInterpolant" instead of "interp3" I get the following error message:
Error using griddedInterpolant The number of input coordinate arrays does not equal the number of dimensions (NDIMS) of these arrays.
Basically, I have values only for 2 cylinders, 3 speeds and 3 powers. I want to linearly interpolate for rest of the data between these values.

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!