how can solve the ratio in matlab

20 views (last 30 days)
Wajahat
Wajahat on 8 Aug 2017
Edited: John D'Errico on 9 Aug 2017
how can i solve the the ratio in matlab
y(x)=1./((a^2 + b^2)e^x + (c^2 + d^2)e^-x)
where a, b,c and d are constant.
answer would be some sech()....
  4 Comments
Wajahat
Wajahat on 9 Aug 2017
But in this case (a^2 + b^2) is not equal to (c^2 + d^2), and i want to write the ratio in terms of hyperbolic function in matlab.

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 9 Aug 2017
Edited: John D'Errico on 9 Aug 2017
Sigh. Has no one yet given you a useful answer yet? That is because this is simply not a question about MATLAB, in the sense that it is far easier solved using pencil and paper. Had you asked the question on a forum about mathematics, you would have gotten an answer quickly.
This is a basic transformation of variables problem. You know where you want to go. But sometimes directing a symbolic tool to give you the answer in the form you want is not trivial. Symbolic tools do as they "want", and they cannot see a fundamental form as a target.
First, make things simple.
u = a^2 + b^2
v = c^2 + d^2
Remember that u and v will always be non-negative, in case that proves to be necessary later on. Then we have:
y = 1/(u*exp(x) + v*exp(-x))
Next, pull v out of there. by defining w = u/v.
y = (1/v) * 1/(w*exp(x) + exp(-x))
So, really, this comes down to a simple problem. Even simpler when w==1, since y reduces to y=sech(x)/(2*v)
For w larger or smaller than 1, we can do another transformation. (I'm running out of variable names.)
w = exp(s)
y = (1/v) * 1/(exp(x + s) + exp(-x))
Now, we should remember that a standard sech has a point of symmetry at x==0, but we should also see that this function is just another linear transformation or so away from the target. It has a point of symmetry at x==-s/2. That should help us to recognize the next transformation.
z = x + s/2
y = (1/v)*1/(exp(s/2 + z) + exp(s/2 - z))
Factor out exp(s/2) from those exponentials.
y = 1/(v*exp(s/2)) * 1/(exp(z) + exp(-z))
Now, time to recognize some basic things. exp(s) was w. So exp(s/2) is sqrt(w).
AND don't forget that now we have finally found sech(z) in there.
y = 1/(v*sqrt(w)) * 1/2*sech(z)
y = 1/(2*v*sqrt(w)) * sech(x + s/2)
Finally, if you want, do some more un-transformations to get it all back in terms of a,b,c,d.
You need to make some effort here though. You should now be able to see yourself the rest of your way home on what may even be homework.

More Answers (1)

Akhilesh Thakur
Akhilesh Thakur on 8 Aug 2017
http://www.mathworks.com/matlabcentral/newsreader/view_thread/320259 Are you asking is there any command to solve ratio? Why do you need command if you can create your own function. You just have to divide and call it.

Community Treasure Hunt

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

Start Hunting!

Translated by