In Octave: octave:13> [a,b]=butter(2,0.4); octave:14> a a = 0.206572083826148 0.413144167652296 0.206572083826148 octave:15> [z,p,g]=butter(2,0.4); octave:16> z z = -1 -1 So I can see that the difference equation coefficients are a = [1,2,1]; multiplied by a scaling factor. These correspond to two zeros at -1. But working out the math, I think the difference equation coefficients should be a = [1,-2,1]; (1 - z^-1)(1 - z^-1) = 1 - 2*z^-1 + z^-2 Why is octave telling me that the difference equation coefficient a[1] = 2 instead of -2?

# Simple question about calculating difference equation coefficients

Started by ●February 6, 2011

Reply by ●February 6, 20112011-02-06

On 02/06/2011 01:38 PM, j26 wrote:> In Octave: > > octave:13> [a,b]=butter(2,0.4); > octave:14> a > a = > > 0.206572083826148 0.413144167652296 0.206572083826148 > > octave:15> [z,p,g]=butter(2,0.4); > octave:16> z > z = > > -1 -1 > > So I can see that the difference equation coefficients are a = [1,2,1]; > multiplied by a scaling factor. These correspond to two zeros at -1. But > working out the math, I think the difference equation coefficients should > be a = [1,-2,1]; > > (1 - z^-1)(1 - z^-1) = 1 - 2*z^-1 + z^-2 > > Why is octave telling me that the difference equation coefficient a[1] = 2 > instead of -2?z^2 + 2 * z + 1 = 0 is zero when z = -1, or when z = -1. z^2 - 2 * z + 1 = 0 is zero when z = 1, or when z = 1. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html

Reply by ●February 6, 20112011-02-06

On 02/06/2011 01:38 PM, j26 wrote:> In Octave: > > octave:13> [a,b]=butter(2,0.4); > octave:14> a > a = > > 0.206572083826148 0.413144167652296 0.206572083826148 > > octave:15> [z,p,g]=butter(2,0.4); > octave:16> z > z = > > -1 -1 > > So I can see that the difference equation coefficients are a = [1,2,1]; > multiplied by a scaling factor. These correspond to two zeros at -1. But > working out the math, I think the difference equation coefficients should > be a = [1,-2,1]; > > (1 - z^-1)(1 - z^-1) = 1 - 2*z^-1 + z^-2 > > Why is octave telling me that the difference equation coefficient a[1] = 2 > instead of -2?z^2 + 2 * z + 1 = 0 is zero when z = -1, or when z = -1. z^2 - 2 * z + 1 = 0 is zero when z = 1, or when z = 1. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html

Reply by ●February 6, 20112011-02-06

The Transfer function in matlab and octave are modelled with numerator and denominator coefficients being all positives. H(z) = (bo + b1 z^-1 + b2 z^-2 .....)/(a0 + a1 z^-1 + a2 z^-2 + .....) So when you want to translate this to time domain (difference equation) the denominator coefficient signs would change. Work out it is simple math. Regards Bharat

Reply by ●February 7, 20112011-02-07

On Feb 6, 10:38�pm, "j26" <ptd26@n_o_s_p_a_m.live.com> wrote:> In Octave: > > octave:13> [a,b]=butter(2,0.4); > octave:14> a > a = > > � �0.206572083826148 � 0.413144167652296 � 0.206572083826148 > > octave:15> [z,p,g]=butter(2,0.4); > octave:16> z > z = > > � -1 �-1 > > So I can see that the difference equation coefficients are a = [1,2,1]; > multiplied by a scaling factor. �These correspond to two zeros at -1. �But > working out the math, I think the difference equation coefficients should > be a = [1,-2,1]; > > (1 - z^-1)(1 - z^-1)= (z - 1)(z - 1) = 0 => z = ? Rune