# Matlab: Butterworth Filter Bode Plot

I'm stuck on a really simple problem because I haven't done matlab in a while. I have transfer functions for nth order lowpass Butterworth Filters:
H(jw) = 1/(s + w_c)^n

I want to plot the 1st to 5th order filters. How do I input H(jw) into matlab? The tf(num, den) is not efficient in that case because I would have to expand out the denominator. I already know the zeros and poles of my transfer function so would there be an easier way to implement H(jw)? Thanks.

I've had to do this without the tf toolbox before. Why can't you just plot the magnitude and phase of the function with a frequency variable f = 0:1:100000 or whatever range you're interested in, where s = f*i*2*pi?

I don't have Matlab with me at the moment, but there should be a 'Butter' function which takes the cut-off frequency and order as inputs and returns the numerator and denominator of the transfer function.
There should also be a tf function which accepts the poles and zeros as inputs, instead of the num and den polynomials (or at least a polynomial function that returns the coefficients given its zeros; the inverse of 'roots')
And if all those functions wouldn't be available in your Matlab version, you could still calculate the polynomial coefficients yourself with convolutions.

Edit: the polynomial function is 'poly(vector_containing_roots)'

Edit2: sys=zpk(zeros,poles,k), where k is a multiplicative constant.

Edit3: or even simpler, I always forget this simple and elegant solution (I don't know if there's a version requirement):
s=tf('s'); %from now on you can use s as the Laplace variable in expressions! (Also possible zo use 'z' for discrete-time systems)
H=1/(s + w_c)^3;
bode(H);

Last edited: