matrix of data into a formula

1 visualización (últimos 30 días)
Asliddin Komilov
Asliddin Komilov el 24 de Abr. de 2023
Respondida: Walter Roberson el 24 de Abr. de 2023
I have a data that is 5D matrix of Y(x,n,s,z).
I wonder if there is a function or code that could extract a relation like:
Y=ax+bn+cs+dz;
with some degree of freedom/error maybe.
Thanks in advance.

Respuestas (1)

Walter Roberson
Walter Roberson el 24 de Abr. de 2023
This is to filt Y = ax + bn + cs + dz + constant
xvec = list of valid x values, in the order used to construct Y
nvec = list of valid n values, in the order used to construct Y
svec = list of valid s values, in the order used to construct Y
zvec = list of valid z values, in the order used to construct Y
[Xg, Ng, Sg, Zg] = ndgrid(xvec, nvec, svec, zvec);
A = [Xg(:), Ng(:), Sg(:), Zg(:), ones(numel(Xg),1)];
b = Y(:);
xnsz1 = A\b;
a = xnsz1(1); b = xnsz1(2); c = xnsz1(3); d = xnsz1(4); constant = xnsz1(5);

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by