solving exponential equation help

2 views (last 30 days)
sudipta
sudipta on 11 Jun 2017
Edited: John D'Errico on 12 Jun 2017
exp(-pi*a/x)+exp(-pi*b/x)=1
Please help to solve the equation for obtaining x. a and b are known. Attaching value of a and b as mat file.

Answers (1)

John D'Errico
John D'Errico on 11 Jun 2017
Edited: John D'Errico on 11 Jun 2017
It did not work, because you are using the wrong tool to try to solve this, or you are using a tool in the wrong way.
Solve finds an analytical solution to an equation, or system of equations. Just because you want it to do something, does not mean the code will magically know what you want done.
You have 147 distinct values of a and b.
If you wanted to find the value of Rs that solves the problem for each pair of and b, thus producing 147 distinct results, solve cannot know this is what you wanted. A simple loop would suffice here, although more sophisticated code would do the trick too. Since the sophisticated solution would not be faster, just harder to read and understand, just use a loop.
Or, if you somehow wanted solve to produce one value for Rs that was the overall best possible solution, again, solve would not know that.
Finally, no matter which problem you are trying to solve, no analytical solution will exist, although numerical solutions will be possible.
  3 Comments
Walter Roberson
Walter Roberson on 11 Jun 2017
X = sym( nan(size(a)) );
for K = 1 : numel(a)
this_solution = vpasolve( exp(-pi*a(K)/x) + exp(-pi*b(K)/x)-1), x);
if isempty(this_solution)
fprintf('No solution for a(%d)\n', K);
else
X(K) = this_solution;
end
end
John D'Errico
John D'Errico on 12 Jun 2017
Edited: John D'Errico on 12 Jun 2017
Solve cannot give you an analytical solution. In fact, no analytical solution exists for most values of a and b.
vpasolve will give you a numerical solution if one does exist. Or you can use fzero.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!