필터 지우기
필터 지우기

how to solve a system of linear equation in matlab for gridded data

조회 수: 6 (최근 30일)
FATHIMA JAMSHEENA P
FATHIMA JAMSHEENA P 2023년 5월 18일
편집: Torsten 2023년 5월 22일
I have a linear equation log(P) -log(diff(S)/dt) =log(z) + log(a)+ b*log(S) and gridded values for log(P),log(diff(S)/dt) and log(S) of size 364x9. in which 364 stands for no of days and 9 stands for the no of grids . so i have to solve the above equation for 9 grids to get a, b and z for the available grds in matlab
  댓글 수: 4
Torsten
Torsten 2023년 5월 21일
z and a cannot be solved for separately. So you have 2 unknowns, namely log(az) and b.
And you have 364 x 9 measurement data for 2 unknowns ? Did I understand this correctly ?
log(P(i,j)) - log(diff(S)/dt(i,j)) = log(az)+ b*log(S(i,j))
for 1 <= i <= 364 and 1 <= j <= 9 ?
FATHIMA JAMSHEENA P
FATHIMA JAMSHEENA P 2023년 5월 22일
z, a and b are unknown parameters and for finding them we have to use the above given relation in which P and S data of size 364x9 are available. so if we construct a forloop to find these parameters we have to get a, b and z data of size 9*1 as solution.

댓글을 달려면 로그인하십시오.

답변 (1개)

Torsten
Torsten 2023년 5월 22일
편집: Torsten 2023년 5월 22일
As said, you can't estimate z and a separately. Say you have
y = z + a
and data for y. Say you get z = 4 and a = 2 as solution. Then all combinations of z and a with z + a = 6 would be solutions, too. One says that the problem is overfitted.
If you want to get solutions for the revised problem, use
for i = 1:9
A = [ones(364,1) log(S(:,i))];
b = log(P(:,i))-log(gradient(S(:,i)));
sol = A\b;
za(i) = sol(1);
b(i) = sol(2);
end
I assume that the unit per days for dS/dt is correct. Otherwise, you will have to scale gradient(S(:,i)) by the correct unit.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by