matrix of data into a formula

1 次查看(过去 30 天)
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.

回答(1 个)

Walter Roberson
Walter Roberson 2023-4-24
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);

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by