How can I solve this equation in which variable is in power

4 次查看(过去 30 天)
I tried this but getting wrong solution
syms a b c d
eqn1 = 2.1544 == a*(5.95^b) + c*(5.95^d);
eqn2 = 1.71 == a*(6.72^b) + c*(6.72^d);
eqn3 = 1.99 == a*(6.35^b) + c*(6.35^d);
eqn4 = 1.59 == a*(6.98^b) + c*(6.98^d);
eqns = [eqn1 eqn2 eqn3 eqn4];
vars = [a b c d];
R = vpasolve(eqns,vars);
  1 个评论
AJMIT KUMAR
AJMIT KUMAR 2021-1-18
I got these values by using vpasolve which is wrong (Put back these value to equation, it will not satisfy)
a = -4.5917748078995605780028770985244e-41;
b = 98.395408219472484524557308589775;
c = 61.139888401602841212761952348352;
d = 23.111701126115183488493226207409;

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2021-1-18
One option is to use GlobalSearch:
y = [2.1544; 1.71; 1.99; 1.59];
rhs = @(a,b,c,d) [a*(5.95.^b) + c.*(5.95.^d); a.*(6.72.^b) + c.*(6.72.^d); a.*(6.35.^b) + c.*(6.35.^d); a.*(6.98.^b) + c.*(6.98.^d)];
gs = GlobalSearch;
fcn = @(b) norm(y - rhs(b(1),b(2),b(3),b(4)));
Problem = createOptimProblem('fmincon', 'x0',randn(4,1), 'objective',fcn)
B = run(gs, Problem)
fval = fcn(B)
producing (with reasonable consistency):
B =
67.619440740979044
-1.924836292732742
81.251260559584935
-43.549761874231805
and:
fval =
0.073738107681070
That is likely as good as it can get, although other values may be possible, with:
B =
46.932805349518709
-15.145390708060569
67.619902371215474
-1.924839968141592
producing approximately the same value for ‘fval’.
Note that this is not a particularly well-posed problem, so the individual parameter values will vary, and there could be a wide range of possible solutions.
  4 个评论
AJMIT KUMAR
AJMIT KUMAR 2021-1-19
@ Star Strider Many many thanks to you, I got the values as per my requirement. There is so much to learn about Matlab function.
Star Strider
Star Strider 2021-1-19
As always, my pleasure!
Quite definitely, expecially since new functions continue to be introduced, and older ones are upgraded.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by