user3234456
user3234456

Reputation: 21

My matlab code doesnt work but i dont know why?

I have tried to run this matlab code :

t = 0:1e-10:1e-3;
F=2.335807205111373e+16;
Y=cosh(t*F);
plot(t,Y), grid on

I didn't have plot ?? also result for Y is infinity ?

Where is the problem on my code ??

Upvotes: 0

Views: 96

Answers (2)

User1551892
User1551892

Reputation: 3384

May be you can implement this equation and it will work for you:

enter image description here

I tried to use above formula and got these results:

>> (1 + exp(-2*900))/(2*exp(-900))

ans =

   Inf

>> (1 + exp(-2*700))/(2*exp(-700))

ans =

  5.0712e+303

Upvotes: 0

Paul
Paul

Reputation: 41

The maximum value for a double is 1.7e308. This value is reached when you do the following in Matlab

K>> cosh(710)

ans =

  1.1170e+308

K>> cosh(711)

ans =

   Inf

So, the maximum value you can feed to cosh appears to be 710. The numbers you are using appear to be too high, except for the first one which is 0.

Upvotes: 3

Related Questions