Clear Filters
Clear Filters

Please tell me what corrections can I make when encountering the following error?

4 views (last 30 days)
[X, Y, T] = ndgrid(xspan, yspan, tspan0);
R_pre = interpn(X, Y, T, u_history, x, y, tref, 'linear');
Incorrect use of griddedInterpolant.
GridVectors must define grids whose size is compatible with the Values array.

Answers (1)

Torsten
Torsten on 18 Jun 2024
Moved: Torsten on 18 Jun 2024
We don't know the contents and sizes of the arrays you use. So we are unable to help.
This would work e.g. :
xspan = linspace(0,1,5);
yspan = linspace(3,5,10);
tspan0 = linspace(0,1,22);
u_history = rand(5,10,22);
R_pre = interpn(xspan,yspan,tspan0,u_history,0.2,4,0.25,'linear')
R_pre = 0.3873

Community Treasure Hunt

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

Start Hunting!