From: Walter Roberson on 19 Jul 2010 17:48 Heman wrote: >> y(n)=x1*h'; >> e(n)=d(n)-y(n); >> hh=e(n)*x1/ibeta >> h=h+hh; > I am trying to debug this new problem and i found that the value of y(n) > gets to be NaN when n=44, x1 and h have values but i don't understand > how the result is NaN. Could ibeta be 0? If so then if e(n) or x1 were also 0 and e(n) is floating point or logical, you would have 0./0. which is NaN. (NaN/0. would be NaN, any of the integer data types divided by 0 is 0, and any other number divided by 0 is one of the extreme values for that data type. For example, int8(3)/0 is 127 because 127 is maxint('int8') )
From: Heman on 19 Jul 2010 18:27 Walter Roberson <roberson(a)hushmail.com> wrote in message <i22hec$17v$1(a)canopus.cc.umanitoba.ca>... > Heman wrote: > >> y(n)=x1*h'; > >> e(n)=d(n)-y(n); > >> hh=e(n)*x1/ibeta > >> h=h+hh; > > > I am trying to debug this new problem and i found that the value of y(n) > > gets to be NaN when n=44, x1 and h have values but i don't understand > > how the result is NaN. > > Could ibeta be 0? If so then if e(n) or x1 were also 0 and e(n) is floating > point or logical, you would have 0./0. which is NaN. > > (NaN/0. would be NaN, any of the integer data types divided by 0 is 0, and any > other number divided by 0 is one of the extreme values for that data type. For > example, int8(3)/0 is 127 because 127 is maxint('int8') ) No, ibeta is fixed at 4. it is a constant value. I found out that the problem seems to be with the y(n). it gets the 1st 43 values perfectly but after tat i.e from 44the value all the y(n) values turn out to be NaN. I checked for the values of x1 and h. But, both of them have regular values and no zeros. Thanks
From: Walter Roberson on 19 Jul 2010 18:58 Heman wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <i22hec$17v$1(a)canopus.cc.umanitoba.ca>... >> Heman wrote: >> >> y(n)=x1*h'; >> >> e(n)=d(n)-y(n); >> >> hh=e(n)*x1/ibeta >> >> h=h+hh; >> >> > I am trying to debug this new problem and i found that the value of >> y(n) > gets to be NaN when n=44, x1 and h have values but i don't >> understand > how the result is NaN. >> >> Could ibeta be 0? If so then if e(n) or x1 were also 0 and e(n) is >> floating point or logical, you would have 0./0. which is NaN. >> >> (NaN/0. would be NaN, any of the integer data types divided by 0 is 0, >> and any other number divided by 0 is one of the extreme values for >> that data type. For example, int8(3)/0 is 127 because 127 is >> maxint('int8') ) > > No, ibeta is fixed at 4. it is a constant value. I found out that the > problem seems to be with the y(n). it gets the 1st 43 values perfectly > but after tat i.e from 44the value all the y(n) values turn out to be > NaN. I checked for the values of x1 and h. But, both of them have > regular values and no zeros. If you trace through the code, you can see that as soon as one value of y becomes nan, all of the e() and hh and h values after that point will have to be nan, as nan "pollutes" all computations. If ibeta is fixed at 4, then what we need to ask is whether x1 is also fixed at some value: if it is computed then that would be the code to examine more closely. If x1 is fixed value, then the next most probable cause would be that d(43) or d(44) is nan for some reason.
From: Heman on 19 Jul 2010 20:27 Hey guyz, Thank you soo much. Its working. It was just that the input data being given was crossing the range and once i scaled it everything is perfect. thanks
First
|
Prev
|
Pages: 1 2 3 4 Prev: Powers are slow, multiplies fast; optimized badly? Next: checking/setting part of an array. |