Solving equations in terms of expression

4 views (last 30 days)
Hello everyone, I have 6 equations to solve in MATLAB. I have written a program for that, but the problem is it showing zero value with a warning "Explicit solution could not be found.". I don't know where I am going wrong or may be I should use some other technique to solve this. Please help me to solve this problem.
Thank you.
X = [0.122;0.0578;0.0138;0.147;0.0718;0.0151];
Y = [12;12;12;42;42;42];
Z = [0.000375;0.0015;0.01125;0.000375;0.0015;0.01125];
syms a b c d e f
eq1 = a*(1+tanh(log((b/Z(1))^c)))*Y(1)*d*(1+tanh(log((e/Z(1))^f))) == X(1);
eq2 = a*(1+tanh(log((b/Z(2))^c)))*Y(2)*d*(1+tanh(log((e/Z(2))^f))) == X(2);
eq3 = a*(1+tanh(log((b/Z(3))^c)))*Y(3)*d*(1+tanh(log((e/Z(3))^f))) == X(3);
eq4 = a*(1+tanh(log((b/Z(4))^c)))*Y(4)*d*(1+tanh(log((e/Z(4))^f))) == X(4);
eq5 = a*(1+tanh(log((b/Z(5))^c)))*Y(5)*d*(1+tanh(log((e/Z(5))^f))) == X(5);
eq6 = a*(1+tanh(log((b/Z(6))^c)))*Y(6)*d*(1+tanh(log((e/Z(6))^f))) == X(6);
sol=solve([eq1,eq2,eq3,eq4,eq5,eq6],'a','b','c','d','e','f');

Accepted Answer

Walter Roberson
Walter Roberson on 5 Jul 2017
Edited: Walter Roberson on 8 Jul 2017
solve() is for finding exact closed-form solutions. It is almost always a logical error to seek exact closed-form solutions for questions that involve decimal numbers. For example are we to understand 0.122 as being exactly 122/1000, or are we to understand it as being a number which has been rounded to 0.122 and so is really a number in the interval [0.1215, 0.1225) ? If we could back-construct and find that there was a solution only if the value happened to be exactly (122831927 + 5*sqrt(2))/1000000000 then are we to understand that is the solution we should look for?
You could try with vpasolve(), but that is not certain to find a solution.
The problem becomes easier to deal with if you happen to know that there is a transformation from tanh(log(x)) to (x^2+1)/(x^2-1) as that allows you to get rid of the trig expressions. However, you can only cleanly eliminate 2 of the variables step-wise, at most 3 of the variables, before you start hitting expressions for which there is no closed form solutions or expressions for which computing the solution takes a long long time.
Note that since a*d appears as a multiplicative factor in all of the expressions, and a and d are not used otherwise, it is going to be impossible to isolate a from d: you can at best find their product. And since you have 6 equations in 6 unknowns, that hints that the equations are over-determined, that it will not be possible to accommodate the final equation along with the other 5 -- because you could clearly replace the product a*d with a single variable ad, which would leave you with 6 equations in 5 unknowns.
  3 Comments
Walter Roberson
Walter Roberson on 6 Jul 2017
The a*d effectively being one variable together suggests that you are overdetermining the equations and that there will probably not be a solution.
Look at equations 3 and 6 after substitution of the given values:
12*a*d*(tanh(log(((800*b)/9)^c)) + 1)*(tanh(log(((800*e)/9)^f)) + 1) == 69/5000
42*a*d*(tanh(log(((800*b)/9)^c)) + 1)*(tanh(log(((800*e)/9)^f)) + 1) == 151/10000
The a*d*(tanh(log(((800*b)/9)^c)) + 1)*(tanh(log(((800*e)/9)^f)) + 1) is in common between the two. Call that T for the moment. Then
12 * T == 69/5000
42 * T == 151/10000
so
T = 69/5000/12
T = 151/10000/42
The first of those is about 3.2 times the second one. These equations cannot be consistent.
The same problem happens between eq1 and eq4, and between eq2 and eq6. Thus it cannot be a matter of one extra equation accidentally having slipped in: the equations must be wrong, or else the provided coefficients must be wrong.
Deepti Ranjan Majhi
Deepti Ranjan Majhi on 8 Jul 2017
Thank you very much Walter.
I think I got it now where I am going wrong. Thanks for the help.

Sign in to comment.

More Answers (1)

Torsten
Torsten on 5 Jul 2017
Since no symbolic solution is in sight for your system, use "vpasolve" instead of "solve".
Or try another numerical solver like lsqnonlin or fsolve.
Best wishes
Torsten.
  4 Comments
Torsten
Torsten on 6 Jul 2017
Edited: Torsten on 6 Jul 2017
Try to give initial guesses for the solution parameters and call "vpasolve" with these guesses.
If you don't succeed, you should try "lsqnonlin".
Best wishes
Torsten.

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!