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)
Afficher commentaires plus anciens
Vidushi Koliyan
le 12 Avr 2023
Réponse apportée : Walter Roberson
le 12 Avr 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 commentaires
Réponse acceptée
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.)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!