Effacer les filtres
Effacer les filtres

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 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Walter Roberson
Walter Roberson le 12 Avr 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.)

Plus de réponses (0)

Catégories

En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by