Interpolating multidimensional output and input

4 visualizzazioni (ultimi 30 giorni)
Fernando
Fernando il 20 Ago 2016
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.

Risposte (1)

Andrea Longobardi
Andrea Longobardi il 22 Lug 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 Commenti
Pai-Feng Teng
Pai-Feng Teng il 8 Mar 2021
Hello everyone. Please let me know if you find the answer too. I struggled with the same thing.
Walter Roberson
Walter Roberson il 8 Mar 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.)

Accedi per commentare.

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by