DSPRelated.com
Forums

Problem with atanh

Started by sairamesh90 October 13, 2004


Hi,
I am implenting a turbo decoder for a channel coding scheme. In
that I have to implement a SISO(Soft Input Soft Output) decoder for my
system. In SISO, I have to compute loglikelihood ratios which
invloves formulas involving arctanh(x). I am facing the problem when
x= 1 or -1 then matlab is giving me inf and -inf respectively and it
is giving erroroneous result.
Any help in this regard is highly appreciated.

Best Regards,
-SaiRamesh.





Let us look at the formula for hyperbolic tan inverse

arctanh(x) = 0.5 * log ((1+x)/(1-x))

Substituting the value of x as 1 or -1, you would expect to get some wierd
answer, isn't it? > Hi,
> I am implenting a turbo decoder for a channel coding scheme. In
> that I have to implement a SISO(Soft Input Soft Output) decoder for my
> system. In SISO, I have to compute loglikelihood ratios which
> invloves formulas involving arctanh(x). I am facing the problem when x=
> 1 or -1 then matlab is giving me inf and -inf respectively and it is
> giving erroroneous result.
> Any help in this regard is highly appreciated.
>
> Best Regards,
> -SaiRamesh. >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
> of this message will receive your answer. You need to do a "reply all"
> if you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3
> Yahoo! Groups Links >
>


--
V Ravi Chander,
Research Engineer,
Emerging Technologies and Services Group,
Reliance Infocomm Ltd.




Hi,
Thanks for your reply! It is obvious that it will
give inf when x= 1. I asked in this type of cases,
how to tackle the problem in Matlab, I can not
approximate as the graph of atanh(x)is very sensitive
as x close to 1 or -1. My algorithm has to use
atanh(x). Any help in this regard in MATLAB is highly
appreciated.
Regards,
-SaiRamesh. --- wrote:

> Let us look at the formula for hyperbolic tan
> inverse
>
> arctanh(x) = 0.5 * log ((1+x)/(1-x))
>
> Substituting the value of x as 1 or -1, you would
> expect to get some wierd
> answer, isn't it? > >
> >
> >
> > Hi,
> > I am implenting a turbo decoder for a channel
> coding scheme. In
> > that I have to implement a SISO(Soft Input Soft
> Output) decoder for my
> > system. In SISO, I have to compute loglikelihood
> ratios which
> > invloves formulas involving arctanh(x). I am
> facing the problem when x=
> > 1 or -1 then matlab is giving me inf and -inf
> respectively and it is
> > giving erroroneous result.
> > Any help in this regard is highly appreciated.
> >
> > Best Regards,
> > -SaiRamesh.
> >
> >
> >
> >
> >
> >
> >
> >
> > ------------------------ Yahoo! Groups Sponsor
> >
> > _____________________________________
> > Note: If you do a simple "reply" with your email
> client, only the author
> > of this message will receive your answer. You
> need to do a "reply all"
> > if you want your answer to be distributed to the
> entire group.
> >
> > _____________________________________
> > About this discussion group:
> >
> > To Join:
> >
> > To Post:
> >
> > To Leave:
> >
> > Archives: http://www.yahoogroups.com/group/matlab
> >
> > More DSP-Related Groups:
> http://www.dsprelated.com/groups.php3
> > Yahoo! Groups Links
> >
> >
> >
> >
> > --
> V Ravi Chander,
> Research Engineer,
> Emerging Technologies and Services Group,
> Reliance Infocomm Ltd. >

_______________________________





Sairamesh,

How about doing something like clamping. I mean catch all the values
above a particular maximum or minimum value, lets say above +/- 10000
( select a more reasonable value here) and say its +/-10000. It will
definately introduce some error but the algorithm shud work.

Hope this helps.
Tarang On Wed, 13 Oct 2004 08:50:46 -0700 (PDT), nammi sairamesh
<> wrote:
>
> Hi,
> Thanks for your reply! It is obvious that it will
> give inf when x= 1. I asked in this type of cases,
> how to tackle the problem in Matlab, I can not
> approximate as the graph of atanh(x)is very sensitive
> as x close to 1 or -1. My algorithm has to use
> atanh(x). Any help in this regard in MATLAB is highly
> appreciated.
> Regards,
> -SaiRamesh. > --- wrote:
>
> > Let us look at the formula for hyperbolic tan
> > inverse
> >
> > arctanh(x) = 0.5 * log ((1+x)/(1-x))
> >
> > Substituting the value of x as 1 or -1, you would
> > expect to get some wierd
> > answer, isn't it?
> >
> >
> > >
> > >
> > >
> > > Hi,
> > > I am implenting a turbo decoder for a channel
> > coding scheme. In
> > > that I have to implement a SISO(Soft Input Soft
> > Output) decoder for my
> > > system. In SISO, I have to compute loglikelihood
> > ratios which
> > > invloves formulas involving arctanh(x). I am
> > facing the problem when x=
> > > 1 or -1 then matlab is giving me inf and -inf
> > respectively and it is
> > > giving erroroneous result.
> > > Any help in this regard is highly appreciated.
> > >
> > > Best Regards,
> > > -SaiRamesh.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ------------------------ > ________________________________
> Yahoo! Groups Links
>
> To




You can use if else loop to avoid calculations  at x=1,-1.

For example,

if x=1 & x=-1

y=0; %or whatever value is resonable in your calculations

else

y=atan(x);

end

>From: nammi sairamesh <s...@yahoo.com>
>To: r...@da-iict.org
>CC: m...@yahoogroups.com
>Subject: Re: [matlab] Problem with atanh
>Date: Wed, 13 Oct 2004 08:50:46 -0700 (PDT)
>
>
>Hi,
>      Thanks for your reply! It is obvious that it will
>give inf when x= 1. I asked in this type of cases,
>how to tackle the problem in Matlab, I can not
>approximate as the graph of atanh(x)is very sensitive
>as x close to 1 or -1. My algorithm has to use
>atanh(x). Any help in this regard in MATLAB is highly
>appreciated.
>Regards,
>-SaiRamesh.
>
>
>
>
>
>--- r...@da-iict.org wrote:
>
> > Let us look at the formula for hyperbolic tan
> > inverse
> >
> > arctanh(x) = 0.5 * log ((1+x)/(1-x))
> >
> > Substituting the value of x as 1 or -1, you would
> > expect to get some wierd
> > answer, isn't it?
> >
> >
> > >
> > >
> > >
> > > Hi,
> > >      I am implenting a turbo decoder for a channel
> > coding scheme. In
> > > that I have to implement a SISO(Soft Input Soft
> > Output) decoder for my
> > > system. In SISO, I have to compute loglikelihood
> > ratios  which
> > > invloves formulas involving arctanh(x). I am
> > facing the problem when x=
> > > 1 or -1 then matlab is giving me inf and -inf
> > respectively and it is
> > > giving erroroneous result.
> > > Any help in this regard is highly appreciated.
> > >
> > > Best Regards,
> > > -SaiRamesh.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ------------------------ Yahoo! Groups Sponsor
> > >
> > > _____________________________________
> > > Note: If you do a simple "reply" with your email
> > client, only the author
> > > of this message will receive your answer.  You
> > need to do a "reply all"
> > > if you want your answer to be distributed to the
> > entire group.
> > >
> > > _____________________________________
> > > About this discussion group:
> > >
> > > To Join:  m...@yahoogroups.com
> > >
> > > To Post:  m...@yahoogroups.com
> > >
> > > To Leave: m...@yahoogroups.com
> > >
> > > Archives: http://www.yahoogroups.com/group/matlab
> > >
> > > More DSP-Related Groups:
> > http://www.dsprelated.com/groups.php3
> > > Yahoo! Groups Links
> > >
> > >
> > >     m...@yahoogroups.com
> > >
> > >
> >
> >
> > --
> > V Ravi Chander,
> > Research Engineer,
> > Emerging Technologies and Services Group,
> > Reliance Infocomm Ltd.
> >
> >
> >
>
>
>
>
>_______________________________
>

Hi again!
I dont know what is the step size that you are using for x.
I tried this in MATLAB

atanh(0.999999)

ans =

7.25432861924767

so even if you have a step size as small as 0.000001, the value doesn't
really shoot up for the value of x just before 1 or -1.

You can approximate the value at (x = 1) to 10 (or whatever you think is
suitable in your work).

regards,
Ravi >
>
> Hi,
> Thanks for your reply! It is obvious that it will
> give inf when x= 1. I asked in this type of cases,
> how to tackle the problem in Matlab, I can not
> approximate as the graph of atanh(x)is very sensitive
> as x close to 1 or -1. My algorithm has to use
> atanh(x). Any help in this regard in MATLAB is highly
> appreciated.
> Regards,
> -SaiRamesh. > --- wrote:
>
>> Let us look at the formula for hyperbolic tan
>> inverse
>>
>> arctanh(x) = 0.5 * log ((1+x)/(1-x))
>>
>> Substituting the value of x as 1 or -1, you would
>> expect to get some wierd
>> answer, isn't it?
>>
>>
>> >
>> >
>> >
>> > Hi,
>> > I am implenting a turbo decoder for a channel
>> coding scheme. In
>> > that I have to implement a SISO(Soft Input Soft
>> Output) decoder for my
>> > system. In SISO, I have to compute loglikelihood
>> ratios which
>> > invloves formulas involving arctanh(x). I am
>> facing the problem when x=
>> > 1 or -1 then matlab is giving me inf and -inf
>> respectively and it is
>> > giving erroroneous result.
>> > Any help in this regard is highly appreciated.
>> >
>> > Best Regards,
>> > -SaiRamesh.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ------------------------ Yahoo! Groups Sponsor
>> >
>> > _____________________________________
>> > Note: If you do a simple "reply" with your email
>> client, only the author
>> > of this message will receive your answer. You
>> need to do a "reply all"
>> > if you want your answer to be distributed to the
>> entire group.
>> >
>> > _____________________________________
>> > About this discussion group:
>> >
>> > To Join:
>> >
>> > To Post:
>> >
>> > To Leave:
>> >
>> > Archives: http://www.yahoogroups.com/group/matlab
>> >
>> > More DSP-Related Groups:
>> http://www.dsprelated.com/groups.php3
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>>
>>
>> --
>> V Ravi Chander,
>> Research Engineer,
>> Emerging Technologies and Services Group,
>> Reliance Infocomm Ltd.
>>
>>
> >
>
> _______________________________ >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
> of this message will receive your answer. You need to do a "reply all"
> if you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3
> Yahoo! Groups Links >
>


--
V Ravi Chander,
Research Engineer,
Emerging Technologies and Services Group,
Reliance Infocomm Ltd.



L Bhusal-

> You can use if else loop to avoid calculations at x=1,-1.
>
> For example,
>
> if x=1 & x=-1
>
> y=0; %or whatever value is resonable in your calculations
>
> else
>
> y=atan(x);

Or just add a small value to adjust magnitude:

y = arctanh(x - sign(x)*eps);

Then the formula becomes:

arctanh(x) = 0.5 * log((1+x+sign(x)*eps)/(1-x-sign(x)*eps))

Values for x=1, x=-1 will not be invalid and results should be fairly accurate.

-Jeff > >From: nammi sairamesh <>
> >To:
> >CC:
> >Subject: Re: [matlab] Problem with atanh
> >Date: Wed, 13 Oct 2004 08:50:46 -0700 (PDT)
> >
> >
> >Hi,
> > Thanks for your reply! It is obvious that it will
> >give inf when x= 1. I asked in this type of cases,
> >how to tackle the problem in Matlab, I can not
> >approximate as the graph of atanh(x)is very sensitive
> >as x close to 1 or -1. My algorithm has to use
> >atanh(x). Any help in this regard in MATLAB is highly
> >appreciated.
> >Regards,
> >-SaiRamesh.
> >
> >
> >
> >
> >
> >--- wrote:
> >
> > > Let us look at the formula for hyperbolic tan
> > > inverse
> > >
> > > arctanh(x) = 0.5 * log ((1+x)/(1-x))
> > >
> > > Substituting the value of x as 1 or -1, you would
> > > expect to get some wierd
> > > answer, isn't it?
> > >
> > >
> > > >
> > > >
> > > >
> > > > Hi,
> > > > I am implenting a turbo decoder for a channel
> > > coding scheme. In
> > > > that I have to implement a SISO(Soft Input Soft
> > > Output) decoder for my
> > > > system. In SISO, I have to compute loglikelihood
> > > ratios which
> > > > invloves formulas involving arctanh(x). I am
> > > facing the problem when x=
> > > > 1 or -1 then matlab is giving me inf and -inf
> > > respectively and it is
> > > > giving erroroneous result.
> > > > Any help in this regard is highly appreciated.
> > > >
> > > > Best Regards,
> > > > -SaiRamesh.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------
> [click here] > ---------------------------
> Yahoo! Groups Links
>
> * To




Hi,
Thanks for ur reply! I also tried that, but as I
mentioned the value is very sensitive as x tends to 1
or -1 , ! so if u try for .9999999 we can see drastic
change, ! but as for .999....9(fifteen 9s) its value
is around 18.57 , after that it becomes inf. so i
approximated the value to that
.999....9. with a little error.
anyhow i solved the problem , thanks for giving
inputs!
Best Regards,
-SaiRamesh. --- V Ravi Chander <>
wrote:

>
> Hi again!
> I dont know what is the step size that you are using
> for x.
> I tried this in MATLAB
>
> atanh(0.999999)
>
> ans =
>
> 7.25432861924767
>
> so even if you have a step size as small as
> 0.000001, the value doesn't
> really shoot up for the value of x just before 1 or
> -1.
>
> You can approximate the value at (x = 1) to 10 (or
> whatever you think is
> suitable in your work).
>
> regards,
> Ravi > >
> >
> > Hi,
> > Thanks for your reply! It is obvious that it
> will
> > give inf when x= 1. I asked in this type of cases,
> > how to tackle the problem in Matlab, I can not
> > approximate as the graph of atanh(x)is very
> sensitive
> > as x close to 1 or -1. My algorithm has to use
> > atanh(x). Any help in this regard in MATLAB is
> highly
> > appreciated.
> > Regards,
> > -SaiRamesh.
> >
> >
> >
> >
> >
> > --- wrote:
> >
> >> Let us look at the formula for hyperbolic tan
> >> inverse
> >>
> >> arctanh(x) = 0.5 * log ((1+x)/(1-x))
> >>
> >> Substituting the value of x as 1 or -1, you would
> >> expect to get some wierd
> >> answer, isn't it?
> >>
> >>
> >> >
> >> >
> >> >
> >> > Hi,
> >> > I am implenting a turbo decoder for a
> channel
> >> coding scheme. In
> >> > that I have to implement a SISO(Soft Input Soft
> >> Output) decoder for my
> >> > system. In SISO, I have to compute
> loglikelihood
> >> ratios which
> >> > invloves formulas involving arctanh(x). I am
> >> facing the problem when x=
> >> > 1 or -1 then matlab is giving me inf and -inf
> >> respectively and it is
> >> > giving erroroneous result.
> >> > Any help in this regard is highly appreciated.
> >> >
> >> > Best Regards,
> >> > -SaiRamesh.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > ------------------------ Yahoo! Groups Sponsor
> >> >
> >> > _____________________________________
> >> > Note: If you do a simple "reply" with your
> email
> >> client, only the author
> >> > of this message will receive your answer. You
> >> need to do a "reply all"
> >> > if you want your answer to be distributed to
> the
> >> entire group.
> >> >
> >> > _____________________________________
> >> > About this discussion group:
> >> >
> >> > To Join:
> >> >
> >> > To Post:
> >> >
> >> > To Leave:
> >> >
> >> > Archives:
> http://www.yahoogroups.com/group/matlab
> >> >
> >> > More DSP-Related Groups:
> >> http://www.dsprelated.com/groups.php3
> >> > Yahoo! Groups Links
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >> --
> >> V Ravi Chander,
> >> Research Engineer,
> >> Emerging Technologies and Services Group,
> >> Reliance Infocomm Ltd.
> >>
> >>
> >>
> >
> >
> >
> >
> > _______________________________
> >
> >
> >
> >
> >
> >
> > _____________________________________
> > Note: If you do a simple "reply" with your email
> client, only the author
> > of this message will receive your answer. You
> need to do a "reply all"
> > if you want your answer to be distributed to the
> entire group.
> >
> > _____________________________________
> > About this discussion group:
> >
> > To Join:
> >
> > To Post:
> >
> > To Leave:
> >
> > Archives: http://www.yahoogroups.com/group/matlab
> >
> > More DSP-Related Groups:
> http://www.dsprelated.com/groups.php3
> > Yahoo! Groups Links
> >
> >
> >
> > --
> V Ravi Chander,
> Research Engineer,
> Emerging Technologies and Services Group,
> Reliance Infocomm Ltd. >

_______________________________