MATLAB Answers

Calculation of cosh, sinh big numbers

14 views (last 30 days)
john on 27 Feb 2014
Commented: john on 9 Mar 2014
let t is time. How can I calculate and plot:
for i=1:10
y=0.912*sin(314.0*t) - 3.31*cos(314.0*t) + (3.31*(cosh(1399.0*t) + 0.484*sinh(1399.0*t)))/exp(1500.0*t)
I got NaN from cosh and sinh for time can I block cosh, sinh if actual value is NaN?
Thank you

Accepted Answer

Roger Stafford
Roger Stafford on 27 Feb 2014
Edited: Roger Stafford on 27 Feb 2014
All three quantities, cosh(1399.0*t), sinh(1399.0*t), and exp(1500.0*t), will fall far beyond the realmax limit. I would suggest you refer to the definitions of sinh and cosh and modify your expression as follows. Replace cosh(1399.0*t)/exp(1500.0*t) by (exp(-101*t)+exp(-2899*t))/2 and similarly with sinh. That way you will not get NaNs even though these are equivalent expressions.
john on 9 Mar 2014
OK, thank you.
It is not your fault, that there is no automatic function.
Thank you

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!