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

2 visualizaciones (últimos 30 días)
FATHIMA JAMSHEENA P
FATHIMA JAMSHEENA P el 18 de Mayo de 2023
Editada: Torsten el 22 de Mayo de 2023
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 comentarios
Torsten
Torsten el 21 de Mayo de 2023
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 el 22 de Mayo de 2023
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.

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 22 de Mayo de 2023
Editada: Torsten el 22 de Mayo de 2023
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.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by