On Dec 11, 11:40 am, Kris Matrix <x...@no.email> wrote:
> I have this code . I know it works in MATLAB. I tried to make it work in MathScript but in the last step, i only get M to be a zero matrix. however it should have values then. What is wrong??
> t = (0:0.0000001:.01);
> f1 = .0011312*cos(2*pi*49400*t);
> f2 = .0033936*cos(2*pi*100*t);
> H = (f1 + f2);
> x = ((2.93464*10^-10)*H);
> ms=1000;
> M = ms * (coth(x) - (1./x));
Another update. I ran your code in Matlab using variable precision
arithmetic as follows.
>> digits(25)
>> y = vpa(x);
>> z = y([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
>> 1000 * (coth(z) - (1./z))
ans =
[ .5000e-9, .4000e-9, .4000e-9, .4000e-9, .4000e-9, .4000e-9, .
4000e-9, .4000e-9, .5000e-9, .5000e-9]
The answer given by variable precision arithmetic for the first ten x
values is completely different than the values given by double
precision arithmetic.
Howard