Interpolating multidimensional output and input

3 visualizaciones (últimos 30 días)
Fernando
Fernando el 20 de Ag. de 2016
Comentada: Walter Roberson el 8 de Mzo. de 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.

Respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by