'solve' not working as expected for Log Equations

2 Ansichten (letzte 30 Tage)
Jaquen Allen
Jaquen Allen am 18 Jun. 2021
Kommentiert: Walter Roberson am 19 Jun. 2021
Not sure why the first equation (f) cannot find a solution but the second (g) can? They are the same equation just in different forms.
Am I misunderstanding something about how the matlab solver works?
clc; clear
syms n k real
y=[.2;.6]; t=[280; 425];
f1= y(1)==1-exp(-k.*t(1).^n);
f2= y(2)==1-exp(-k.*t(2).^n);
Sol=solve(f1,f2)
g1= log(log(1/(1-y(1))))==n*log(t(1))+log(k);
g2= log(log(1/(1-y(2))))==n*log(t(2))+log(k);
Sol=solve(g1,g2)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Jun. 2021
if you vpasolve() and use a low enough start then it will find a solution
ss=vpasolve([f1,f2],[n,k], [.8999999040792;1])
The start point I show here is about the upper limit; for example .8999999040793 will not work.
  2 Kommentare
Jaquen Allen
Jaquen Allen am 19 Jun. 2021
So the only way to solve in that form is to have an approx estimate of the values you're looking for? Appreciate the help!
Walter Roberson
Walter Roberson am 19 Jun. 2021
.89 is pretty far from the actual value, on a relative scale.
clc; clear
syms n k real
y=[.2;.6]; t=[280; 425];
f1= y(1)==1-exp(-k.*t(1).^n);
f2= y(2)==1-exp(-k.*t(2).^n);
eqn = [f1,f2];
Sol = vpasolve(eqn, [n, k], [50;0]);
[Sol.n, Sol.k], subs(eqn, Sol)
ans = 
ans = 
Sol.n
ans = 
50.0
Sol = vpasolve(eqn, [n, k], [0;0]);
[Sol.n, Sol.k], subs(eqn, Sol)
ans = 
ans = 
It looks like too large of an initial guess leads to false solutions if it gives a solution at all.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by