File:Raised-cosine filter.svg

Summary

Description
English: Frequency response of raised cosine filter for different values of .
Date
Source Own work
Author Krishnavedala
Other versions File:Raised-cosine-filter.png
SVG development
InfoField
Source code
InfoField

Python code

from numpy import *
from matplotlib.pyplot import *
from mpl_toolkits.axes_grid.axislines import SubplotZero

def makeT(lim=1):	# Make the X-axis
	result = linspace(-lim,lim,100)
	return result

def sinc(x):		# define normlized sinc function
	return sin(pi*x)/(pi*x)
	
def raisedCos(freq,B=0.,T=1.):	# define raised cosine function
	freq = fabs(freq)
	if freq <= (1.-B)*0.5/T:
		result = T
	elif freq <= (1.+B)*0.5/T:
		temp = freq - (1-B)*0.5/T
		result = 0.5*T*( 1+cos(pi*temp*T/B) )
	else:
		result = 0
	return result
	
fig = figure(figsize=(8,4))
ax = SubplotZero(fig,111)
fig.add_subplot(ax)
ax.grid(True)
ax.set_xticks([-1,-.5,0,.5,1])
ax.set_xticklabels([r"$-\frac{1}{T}$",r"$-\frac{1}{2T}$",\
	"0",r"$\frac{1}{2T}$",r"$\frac{1}{T}$"])
ax.set_ylim((-.3,1.2))
ax.set_yticklabels([])
for direction in ["xzero","yzero"]:
	ax.axis[direction].set_axisline_style("-&#x7C;>")
	ax.axis[direction].set_visible(True)
for direction in ["left","right","bottom","top"]:
	ax.axis[direction].set_visible(False)

t = makeT(1.25)
H0,H1,H2,H3 = [],[],[],[]
for i in t:
	H0 = append(H0,raisedCos(i,0))
	H1 = append(H1,raisedCos(i,0.25))
	H2 = append(H2,raisedCos(i,0.5))
	H3 = append(H3,raisedCos(i,1.))
ax.plot(t,H0,label=r"$\beta=0$")
ax.plot(t,H1,label=r"$\beta=0.25$")
ax.plot(t,H2,label=r"$\beta=0.5$")
ax.plot(t,H3,label=r"$\beta=1$")

ax.text(1.25,0.,r"$f$")
ax.text(0.05,1.15,r"$H(f)$")
ax.legend()
#fig.show()
fig.savefig("Raised-cosine filter.svg",bbox_inches="tight",\
	pad_inches=.15)

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Raised-cosine%20filter.svg
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
Category:License migration redundant#Raised-cosine%20filter.svgCategory:GFDL#Raised-cosine%20filter.svg
You may select the license of your choice.
Category:Self-published work
Category:Raised-cosine filters Category:SVG created with Matplotlib Category:Images with Python source code
Category:CC-BY-SA-3.0 Category:GFDL Category:Images with Python source code Category:License migration redundant Category:Raised-cosine filters Category:SVG created with Matplotlib Category:Self-published work Category:Valid SVG created with Matplotlib code