I want to solve this equation for a and b where A and B is a vector data with dimension (1344x1) A=a(B)^b
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Vidushi Koliyan
el 12 de Abr. de 2023
Respondida: Walter Roberson
el 12 de Abr. de 2023
Here; A = data1 ; B = data2
y = data1;
Y = log(y);
A = [ones(length(y),1) log(data2)'];
X1 = inv(A'*A);
X2 = A'.*Y;
X = X1*X2;
a = exp(X(1:1,1));
b = X(2,1:1);
this is the method I am using to solve for this equation. But I am not sure this is the right way to solve nonlinear equations. Can someone suggest an alternate way with an example?
Thank you
0 comentarios
Respuesta aceptada
Walter Roberson
el 12 de Abr. de 2023
p = polyfit(log(B), log(A), 1);
a = exp(p(2));
b = p(1);
This would at least be a good starting point for a search in linear space (it should be close to as good as you can get in log space.)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!