Interpolating multidimensional output and input

6 ビュー (過去 30 日間)
Fernando
Fernando 2016 年 8 月 20 日
コメント済み: Walter Roberson 2021 年 3 月 8 日
Hi,
I have a function that uses a three-element vector as input and gives a two-element vector as output. From evaluating the function at a large number of three-element vectors, I have the the corresponding number of two-element outputs. Now I want to interpolate the inputs and outputs but I don't know how. I know that if the output was a single number per three-element vector, then I could use interpn, but in my case the output has two elements that are not independent of each other.
For example, one could have
Input = [0 0 0; 0 0 0.5; 0 0 1; 0 0.5 0; 0 0.5 0.5; 0 0.5 1;...
0 1 0; 0 1 0.5; 0 1 1; 0.5 0 0; 0.5 0 0.5;...
0.5 0 1; 0.5 0.5 0; 0.5 0.5 0.5; 0.5 0.5 1; 0.5 1 0; 0.5 1 0.5;...
0.5 1 1; 1 0 0; 1 0 0.5; 1 0 1; 1 0.5 0; 1 0.5 0.5; 1 0.5 1;...
1 1 0; 1 1 0.5; 1 1 1];
Output = rand(length(State),2);
% rand is just used for the example. In practice, this is
% Output = zeros(length(Input),2);
% for i=1:length(Input),
% Output(i,:) = function(Input(i,:));
% end
So, now I need to interpolate the output vectors for the interpolated input, but this has to be jointly for the two elements of the output vector. Any suggestions?
Thanks.

回答 (1 件)

Andrea Longobardi
Andrea Longobardi 2019 年 7 月 22 日
Hi, I've the same problem of yours. Did you find any solution? If yes, do you remember it? Thank you in advance.
  4 件のコメント
Pai-Feng Teng
Pai-Feng Teng 2021 年 3 月 8 日
Hello everyone. Please let me know if you find the answer too. I struggled with the same thing.
Walter Roberson
Walter Roberson 2021 年 3 月 8 日
Use separate interpolations.
For any one of the output elements, the value of the output is determined by the recorded data and the query point, and not by any of the other outputs. This is true even if the task were something like to find the nearest point on a 2D shape and return the x and y coordinates . (It is, of course, not true if you have a random component in choosing the output value.)

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by