/* This code is released into the public domain This maxima code works out the critical gain and oscillation frequency of a three stage RC phase shift oscillator where the three RC stages are identical */ /*ABCD matrices for the three RC stages*/ ABCD: matrix([1+1/(R*C*s),1/(C*s)],[1/R,1])$ assume(R>0,C>0)$ /*Obtain transfer function of overall RC phase shifter network*/ ABCD: ABCD.ABCD.ABCD$ ABCD: ABCD,s=%i*w$ 1/list_matrix_entries(ABCD)[1]$ H: ratsimp(%)$ /*Calculate oscillation frequency*/ solve(imagpart(H),w)$ map(lambda([eq],rhs(eq)),%)$ sublist(%,lambda([x],is (x>0)))$ w0: %[1]$ f0: w0/(2*%pi)$ /*Calculate critical gain*/ H,w=w0$ G: combine(expand(ratsimp(-1/%)))$ /*Print results*/ display(G,f0);