matrix of data into a formula

조회 수: 2 (최근 30일)
Asliddin Komilov
Asliddin Komilov 2023년 4월 24일
답변: Walter Roberson 2023년 4월 24일
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