Page 1 of 1

An Octave script to help analyze transfer functions

Posted: Sat Apr 04, 2015 12:09 pm
by distro inferno
Hi everyone, I've made a short Octave script (Octave is the open source version of Matlab) which helps a person analyze transfer equations, of the form
A(s) = [DC gain * zeros]/[poles]

The control toolbox in Octave is great and offers lots of nice ways to plot a transfer function, including highlighting the poles and zeros in an x-y plane to help with placing compensation poles, or just producing normal Bode plots. These are important for anyone building amplifiers with feedback to prevent unwanted oscillations and instability, and also figure out what the gain is at different frequencies.

The code is available here on my git: and I welcome any advice, pull requests or questions! This program was originally created as part of an overnight hackathon last week.

The script uses a few menus accepting user input to assemble the transfer function and then plot it with one of several built-in plot types. It's mostly a wrapper to make it easier to quickly iterate through different amplifier/filter designs. My current goal is to make it accept command-line inputs from the Linux terminal so that a person could use a script to analyze a large range of possible values, and then just look at the resulting plots to get an idea about where compensation poles should be placed, or what the filter looks like in the frequency domain.

A Bode plot and phase plot done in ASCII. This happens if you use Gnuplot, which occurs by default if you're ssh'd into a Beaglebone or other device which is doing the calculations.

An Octave plot highlighting the gain margin and phase margin for a filter.