# Root\_raised\_cosine principle

**URL:** <https://www.ruby-forum.com/t/root-raised-cosine-principle/231822>\
**Category:** GNU Radio\
**Created:** [September 1, 2014, 5:03pm UTC](https://www.ruby-forum.com/t/root-raised-cosine-principle/231822 "2014-09-01T17:03:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 1, 2014, 5:03pm UTC](https://www.ruby-forum.com/t/root-raised-cosine-principle/231822/1 "2014-09-01T17:03:11Z")

</div>

Hi,  
I get the source code of root\_raised\_cosine function in gr\_firdes.cc,  
but I can’t understand why it writes in that way, is there any paper can  
give me more details about the principle of root\_raised\_cosine  
Thank you

this is the source code of root\_raised\_cosine  
vector gr\_firdes::root\_raised\_cosine (double gain,  
double sampling\_freq,  
double symbol\_rate,  
double alpha,  
int ntaps)  
{  
ntaps |= 1; // ensure that ntaps is odd

double spb = sampling\_freq/symbol\_rate; // samples per bit/symbol  
vector taps(ntaps);  
double scale = 0;  
for(int i=0;i\<ntaps;i++)  
{  
double x1,x2,x3,num,den;  
double xindx = i - ntaps/2;  
x1 = M\_PI \* xindx/spb;  
x2 = 4 \* alpha \* xindx / spb;  
x3 = x2_x2 - 1;  
if( fabs(x3) \>= 0.000001 ) // Avoid Rounding errors…  
{  
if( i != ntaps/2 )  
num = cos((1+alpha)x1) + sin((1-alpha)x1)/(4alphaxindx/spb);  
else  
num = cos((1+alpha)x1) + (1-alpha) \* M\_PI / (4alpha);  
den = x3 \* M\_PI;  
}  
else  
{  
if(alpha==1)  
{  
taps[i] = -1;  
continue;  
}  
x3 = (1-alpha)x1;  
x2 = (1+alpha)x1;  
num = (sin(x2)(1+alpha)M\_PI  
- cos(x3)((1-alpha)M\_PIspb)/(4alpha_xindx)  
+ sin(x3)_spb_spb/(4_alpha_xindx\*xindx));  
den = -32 \* M\_PI \* alpha \* alpha \* xindx/spb;  
}  
taps[i] = 4 \* alpha \* num / den;  
scale += taps[i];  
}

for(int i=0;i\<ntaps;i++)  
taps[i] = taps[i] \* gain / scale;

return taps;  
}

---

<div class="post-metadata">

**Author:** ![adream](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@adream](https://www.ruby-forum.com/u/adream)\
**Post date:** [September 1, 2014, 5:20pm UTC](https://www.ruby-forum.com/t/root-raised-cosine-principle/231822/2 "2014-09-01T17:20:51Z")

</div>

On 09/01/2014 05:01 PM, adream wrote:

> Hi,  
> I get the source code of root\_raised\_cosine function in gr\_firdes.cc,  
> but I can’t understand why it writes in that way, is there any paper can  
> give me more details about the principle of root\_raised\_cosine

Any standard textbook on digital communications will explain this. You  
might want to look out for keywords such as pulse shaping and Nyquist  
criterion. Have a look at the wiki page for recommended reading.

M

---

<div class="post-metadata">

**Author:** ![adream](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@adream](https://www.ruby-forum.com/u/adream)\
**Post date:** [September 2, 2014, 10:54am UTC](https://www.ruby-forum.com/t/root-raised-cosine-principle/231822/3 "2014-09-02T10:54:09Z")

</div>

Please stick to the list.

On 09/01/2014 05:35 PM, adream wrote:

> Thanks for your reply  
> May be I should make my question more specifically,
> 
> den = -32 \* M\_PI \* alpha \* alpha \* xindx/spb;
> 
> I can’t understand well why there is “-32”

That I don’t know. Of course, it’s just a gain change, so it won’t  
affect the spectral shape.  
Perhaps Tom can weigh in here.

M

---

<div class="post-metadata">

**Author:** ![adream](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/53a042/32.png) [@adream](https://www.ruby-forum.com/u/adream)\
**Post date:** [September 3, 2014, 3:53pm UTC](https://www.ruby-forum.com/t/root-raised-cosine-principle/231822/4 "2014-09-03T15:53:27Z")

</div>

On Mon, Sep 1, 2014 at 11:50 AM, Martin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> That I don’t know. Of course, it’s just a gain change, so it won’t  
> affect the spectral shape.  
> Perhaps Tom can weigh in here.
> 
> M

I looked at that, and I’m not sure where that 32 came from. This code is  
very old, probably back from the late 90’s even. I probably would have  
written that a lot differently than the code that’s in there, but I will  
say that this code does at least build an RRC filter. Though I’d be  
curious  
if you could point to the results being (significantly) different given  
what you think the filter coefficients given the same parameters should  
be.

Tom
