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

2 views (last 30 days)
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 Comment
AJMIT KUMAR
AJMIT KUMAR on 18 Jan 2021
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;

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 18 Jan 2021
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 Comments
AJMIT KUMAR
AJMIT KUMAR on 19 Jan 2021
@ 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 on 19 Jan 2021
As always, my pleasure!
Quite definitely, expecially since new functions continue to be introduced, and older ones are upgraded.

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!