MATLAB: Hyperbolic Functions series convergence issue

MATLAB: Hyperbolic Functions series convergence issue

hyperbolic function series convergence

I’am trying to run a code which has attached with this i’am getting answer as NAN i think the reason behind this is because of term e in this it contains sinh terms as n increases sinh values increases but if i keep x=0 then also it is coming NAN if you see the equation as x=0 then e will be 2*B1*sin(k2*(di+dd-y))/di which i have written as uu in code now after convergence it comes to 1.002(Vbi) which is correct by physics
but again e term is coming NAN because of this phi is coming NAN same goes to x=L or any value of 0
see the code below
how this can be remove ?

Best Answer

  • You have
    With di being 5E-9, 2*di is 1E-8, so k2 = 1E8 * (2*n-1) * pi . Multiply that by L = 1.2E-7 and you get 12 * (2*n-1) * pi . When you reach n = 10, that leads you to calculating sinh(12 * 19 * pi), which overflows to infinity. That happens on both the numerator and denominator, leading you to infinity / infinity, which is NaN. That NaN then pollutes the rest of the calculation.
    By the time of the overflow, you are probably pretty safe making some approximations on the (B1*sinh(k2*(L-x))+B2*sinh(k2*x))/(di*sinh(k2*L)) . For example you could taylor it, and then get rid of the elements that are going to have no effect. For example,
    is completely dominated by the first term, so you can reduce the complexity of the taylored expression.
  • Add a Comment

    Your email address will not be published. Required fields are marked *