Extrapolation of a 2D data table with 3 input variables

10 ビュー (過去 30 日間)
Crystal Green
Crystal Green 2020 年 1 月 24 日
コメント済み: Crystal Green 2020 年 1 月 28 日
I have a table 'V' that is m x n dimensions. However, the m dimension is dependont on (x,y) and the n dimension is dependent on z. I am able to interpolate data in the table by using griddata. Where
griddata(x_grid, y_grid, z_grid, V)
x_grid, y_grid_ and z_grid are mxn double arrays that contain the specific x y and z coordinates.
Griddata allows me to interpolate between points within the dataset but I would also like to extrapolate data as well. Any help would be greatly appreciated. I have had no luck with griddedInterpoant or scatteredInterpolant: I get the following errors:
griddedInterpolant(x_grid,y_grid,z_grid,V, 'linear', 'linear')
"Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions (NDIMS) of these arrays"
K>> scatteredInterpolant({x_grid,y_grid,z_grid},V)
Error using scatteredInterpolant
The input points must be a double array.
.

回答 (1 件)

Githin John
Githin John 2020 年 1 月 27 日
The scatteredInterpolant function takes the x_grid, y_grid and z_grid inputs as column vectors. You can provide the inputs in that form rather than a mxn array.
For griddedInterpolation, the x_grid, y_grid and z_grid values should be something like those generated using ndgrid.
For more information on the format of inputs, you can check the examples section in the documentation.
  1 件のコメント
Crystal Green
Crystal Green 2020 年 1 月 28 日
I have tried scatteredInterpolant using column vectors. I get the following error
Error using scatteredInterpolant
Data point coordinates have inconsistent dimension.
I have also tried griddedInterpolant usign the x_grid, y_grid and z_grid inputs which are in in the ndgrid format
Error using griddedInterpolant
The number of input coordinate arrays does not equal the number of dimensions (NDIMS) of these arrays.
And I have run everything using the ndims command and all are the same number of dimensions so I'm not sure why it is not working

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by