Interpolation across only 1 dimension for a multi-dimensional array
Mostra commenti meno recenti
I have an 3D-array V that is 2x1000x5 and contains the values of two functions (dimension 1) each of the same two inputs (dimensions 2 and 3). For resource reasons, I cannot increase the the number of points in each input grid before the calculation of V, but I would still like to see estimates of the function along the intermediate points, hence the need for interpolation. My goal is to interpolate accross the first input (dimension 2), while leaving the other two dimensions unchanged.
The code I have is the following:
n_a=1000; %original size of dimension 2
int_n_a=n_a*10; %interpolated size of dimension 2
a_grid = (linspace(0,1,n_a).^3)'
int_a_grid = (linspace(0,1,int_n_a).^3)'
n_z=5; %size of dimension 3
z_grid = [0.53;0.71;0.96;1.30;1.76]
int_V=interpn(1:2,a_grid,z_grid,V,1:2,int_a_grid,z_grid)
However, this does not seem to do what I intended. The code does not fail, but the values within the object int_V are clearly not the result of the intented interpolation. What is the correct specification for interpolating a multi-dimensional array along only 1 dimension?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Interpolation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!