Interpolating multidimensional output and input

3 Ansichten (letzte 30 Tage)
Fernando
Fernando am 20 Aug. 2016
Kommentiert: Walter Roberson am 8 Mär. 2021
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.

Antworten (1)

Andrea Longobardi
Andrea Longobardi am 22 Jul. 2019
Hi, I've the same problem of yours. Did you find any solution? If yes, do you remember it? Thank you in advance.
  4 Kommentare
Pai-Feng Teng
Pai-Feng Teng am 8 Mär. 2021
Hello everyone. Please let me know if you find the answer too. I struggled with the same thing.
Walter Roberson
Walter Roberson am 8 Mär. 2021
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.)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by