Filter löschen
Filter löschen

matrix of data into a formula

1 Ansicht (letzte 30 Tage)
Asliddin Komilov
Asliddin Komilov am 24 Apr. 2023
Beantwortet: Walter Roberson am 24 Apr. 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.

Antworten (1)

Walter Roberson
Walter Roberson am 24 Apr. 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);

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by