Hi, I’d like to interpolate data from a 2d array in which the spacing is nonuniform. A is an 11x13 array that is imported from a .csv file, so below I just made it a random array of values (should be good enough while I’m debugging).
using Interpolations
alpha = [-20;-15;-10;-4;-1;0;1;4;10;15;20] #11x1 array nonuniform spacing
mach = [0.1;0.3;0.7;0.8;0.9;1.2;1.5;2.0;3.0;5.0;7.0;8.0;9.0] #13x1 array nonuniform spacing
A = rand(11, 13) #e.g. A[6, 1] should correspond to value with alpha = 0 and mach = 0.1
nodes = ([alpha], [mach])
interp = interpolate(nodes, A, Gridded(Linear()))
display(interp(0.25, 1.4))
ERROR: MethodError: no method matching interpolate(::Tuple{Vector{Matrix{Int64}}, Vector{Matrix{Float64}}}, ::Matrix{Float64}, ::Gridded{Linear{Throw{OnGrid}}})
Closest candidates are:
interpolate(::Any, ::Any, ::Any, ::Any, ::Any) at c:\Git\sep_dynamics_julia\scripts\relative_motion.jl:37
interpolate(::Any, ::Any) at c:\Git\sep_dynamics_julia\scripts\relative_motion.jl:36
The first “closest candidate” seems to me to suggest that it is expecting a 5th input, so I changed interp to interp = interpolate(nodes, A, Gridded(Linear()), Gridded(Linear())) but that simply produces the same output.
I’m not sure where to go from here, any help would be much appreciated. Thanks in advance!
It’s possible that you’re dealing with a VSCode plugin bug, but that particular issue was fixed two years ago, so before troubleshooting further, you’ll want to first make sure that your VSCode plugins are up to date and try restarting the editor.