How to solve for a b c d ?? If i have 4 equations like these in matlab.

2 次查看(过去 30 天)
i have a set of equations like these. i am trying to solve for a b c d. matlab returns numerical approximation instead and the values are way too big. is there anything wrong with the equation??
syms a b c d;
eqn1 = (a+(b/(1+(exp(-((47.71-c)/d))))))==11.1111;
eqn2 = (a+(b/(1+(exp(-((72.17-c)/d))))))==18.5185;
eqn3 = (a+(b/(1+(exp(-((85.38-c)/d))))))==33.3333;
eqn4 = (a+(b/(1+(exp(-((94.79-c)/d))))))==55.5556;
sol = solve(eqn1,eqn2,eqn3,eqn4,a,b,c,d);
  3 个评论
Walter Roberson
Walter Roberson 2017-4-18
11.1111 appears to be standing in for 100/9
33.3333 appears to be standing in for 100/3
55.5556 appears to be standing in for 500/9
But is 18.5185 intended to be standing in for 18 + 14/27 ?
Are there intended fractions for the other numbers such as the 47.71 ?
Walter Roberson
Walter Roberson 2017-4-18
My investigations so far suggest that to within floating point precision, there are many solutions. If you solve the first three equations for a, b, c, then there are multiple thousand terms of exp() adding together, and there is a lot of round-off involved in that process.

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2017-4-19
One of the solutions is
a = 9.82047978530749
b = 320.687014884004
c = 117.506137526386
d = 12.6641844232045
this gives a residue on the order of 1E-22, which is in the noise level compared to the uncertainty on the input coefficients such as 72.17
At the moment I do not seem to find any other solution.

Rik
Rik 2017-4-18
If you take a look at the documentation, you will notice that you need to enter your equations as a vector: sol = solve([eqn1,eqn2,eqn3,eqn4],[a,b,c,d]);
However, this still gives the same answer, so that can't be the problem. What is, I couldn't say, but if you use fit, you get much smaller values.
x=[47.71 72.17 85.38 94.79]';
y=[11.1111 18.5185 33.3333 55.5556]';
sol=fit(x,y,'(a+(b/(1+(exp(-((x-c)/d))))))');
  4 个评论
Walter Roberson
Walter Roberson 2017-4-18
When I use the above method, fit(), then the fit is not a good one. I get
a = 26.9987073814621
b = 2.63091761853793
c = 0.412024384777503
d = 0.308022637282378
If you back-substitute those into the equations then you get
29.629625000000006984635092521785 == 11.111100000000000420641299569979,
29.629625000000006984635092521785 == 18.5185,
29.629625000000006984635092521785 == 33.333300000000001261923898709938,
29.629625000000006984635092521785 == 55.555599999999998317434801720083
which is not good at all.
The fit gets stuck in a local minima with residue approximately 1152.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by