Fitting and predicting from 3D data

27 visualizaciones (últimos 30 días)
Hyder
Hyder el 28 de Nov. de 2024 a las 19:51
Respondida: Star Strider el 29 de Nov. de 2024 a las 1:35
I have a 3D matrix of Outputs which are a function of three variables each varying between some upper and lower bounds.
So essentially the size of the Output matrix is p x q x r, such that the Var1 is a vector of size p, Var2 is size q and Var3 is of size r.
Given a Output Value and a Var1 as scalar inputs , I want to obtain all the corresponding pairs of Var2 and Var3 from this data set.
Is there anyone who might have done something similar and can share some insights into how you did it ?

Respuestas (2)

Walter Roberson
Walter Roberson el 28 de Nov. de 2024 a las 20:07
Editada: Walter Roberson el 28 de Nov. de 2024 a las 20:11
idx = find(Output(Var1,:,:) == OutputValue);
[~, var2, var3] = idx2sub(size(Output), idx);
Except that comparing using == is not recommended for floating point values. You would be better off using ismembertol
I have to wonder, though, whether the given Output Value necessarily matches (to within round-off) anything that appears in the Output matrix. It would be common to instead be probing for intermediate values, like asking where [5,10,15] "would" occur within a matrix that includes [4.2 5.1 7.9 11.3] but not exactly 5 or 10 or 15.
  1 comentario
Hyder
Hyder el 28 de Nov. de 2024 a las 23:03
Editada: Hyder el 28 de Nov. de 2024 a las 23:03
Thanks for your answer Walter. Indeed I think this could work, but the issue would be if the exact value is not there in the table, how would it then find the nearest value, or better still interpolate the data to get the estimate for the exact value of OutputValue and Var1 that was given as inputs.

Iniciar sesión para comentar.


Star Strider
Star Strider el 29 de Nov. de 2024 a las 1:35
I do not know what your data matrices are, however the scatteredInterpolant function could work.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by