'solve' not working as expected for Log Equations
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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)
0 Kommentare
Akzeptierte Antwort
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
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)
Sol.n
Sol = vpasolve(eqn, [n, k], [0;0]);
[Sol.n, Sol.k], subs(eqn, Sol)
It looks like too large of an initial guess leads to false solutions if it gives a solution at all.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!