Polar coordinate vectors. See wikipedia or your first-year maths textbook.
To be able to calculate frequency responses and design filters easily, it is important to be fluent at vector arithmetic, so the the prep for this section contains a bit of practice at that.
Work out the following equations, expressing the results in polar form:
You should also be familiar with multiplication and division.
You must express all results in polar coordinates.
Write python functions to do addition, multiplication, and division of polar coordinates. Functions can return two values by doing
def add(a, b, c, d): ... return magnitude, angle magnitude, angle = add(0, 1, 2, 3) print magnitude, angle
If you use global variables for this, you will make the next 4 exercises a lot harder for yourself. Also, Graham will mock you for the rest of the year.
A few labs ago, we constructed oscillators by placing poles on the unit circle in the z-plane. This concept can be extended by providing the objects we build with an input, and implementing them with poles (and zeros) inside the unit circle.
To calculate the frequency response of such a system, we can follow the procedure described in the "Subtractive Synthesis" chapter of mcm.pdf. This describes an easily-rememered graphical method to calculate the magnitude and phase of a system's transfer function given the position of the poles and zeros. In summary:
Consider a system is running at a sample rate of 44100Hz, having two poles at z = 0.995∠±π/10, and two zeros at z = 0.9∠±π/10.
What is the frequency response at alpha = 0.25 ?
At what frequency does it have maximum gain? And what is that gain?
Make some plots of the magnitude frequency response for the following systems of poles and zeros. This requires you to write a function to figure out the frequency response at a particular point, then call that function a bunch of times so you have your data to plot.
You should have a single frequency_response(poles,
zeros)
function.
def frequency_response(poles, zeros): print poles print zeros # calculate response for a bunch of alpha, # then plot them poles = numpy.array([0.995, 0.31415, 0.995, -0.31415]) zeros = numpy.array([0.9, 0.31415, 0.9, -0.31415]) frequency_response(poles, zeros)
If you're feeling cheeky, you could plot the phase response too, on the same graph.
System sample rate 44100Hz.
Unless otherwise noted, all materials on these pages are licenced under a Creative Commons Licence.