0
$\begingroup$

Some years ago, I had a little tool in FORTRAN and GNUplot output, which was able to plot the step response of an IIR lowpass filter, starting which the location of the poles. Now, this tool is lost and I was thinking that this job is more easy today while using GNU octave. But up to now, I was not able to find the right way. I have used:

pkg load control Z = [0]; P = [-0.1535867376+0.9681464078i -0.1535867376-0.9681464078i -0.3881398518+0.5886323381i -0.3881398518-0.5886323381i -0.4680898756]; K = 1; s = tf('s'); Gs = zpk(Z,P,K); step(Gs), grid on 
$\endgroup$
2
  • $\begingroup$ It is not clear exactly what the question is. Does the code not run as expected? What does it do and what do you expect it to produce? $\endgroup$ Commented Jul 6, 2024 at 11:24
  • $\begingroup$ The code doesn't give the expected output. $\endgroup$ Commented Jul 6, 2024 at 12:24

1 Answer 1

2
$\begingroup$

I entered the OP's code to see the result:

Transfer function 'Gs' from input 'u1' to output ... s y1: ----------------------------------------------------------- s^5 + 1.552 s^4 + 2.204 s^3 + 1.693 s^2 + 0.8983 s + 0.2236 

step response

As an independent verification I used Wolfram Alpha to compute and plot the inverse Laplace Transform of the OP's transfer function multiplied by $1/s$ (the impulse response would be the inverse Laplace Transform of the transfer function directly, and the step response is the product with $1/s$ since the unit step is the integral of an impulse; $1/s$ is the Laplace transform of the unit step $u(t)$). This produced the following result:

input interpretation into Wolfram Alpha

wolfram result

Wolfram result

From this the step response for the derived transfer function is consistent. Just to be sure there wasn't a rounding issue involved in the resulting coefficients returned by Octave's zpk function, I determined the coefficients manually to higher precision for the denominator polynomial and got the following:

 [1.00000000000000, 1.55154305440, 2.20364292488, 1.692742274652363, 0.8983414490248045, 0.2236067977867231] 

I plugged these back into Wolfram Alpha and got the following result which is still consistent with the first result Octave provided:

attempt 2

Even further I used Python's control library and also got a consistent result for the computed step response:

import control as con Z = [0] P = [-0.1535867376+0.9681464078j, -0.1535867376-0.9681464078j, -0.3881398518+0.5886323381j, -0.3881398518-0.5886323381j, -0.4680898756] K = 1 gs = con.zpk(Z,P,K) response = con.step_response(gs) 

Python

With that I do not see any issue with the result returned by Octave.

$\endgroup$
2
  • $\begingroup$ Many thanks, Dan ! The problem is mine. I was unable to introduce the zeroes of the low-pass to the code. What do you recommend me ? $\endgroup$ Commented Jul 9, 2024 at 14:34
  • $\begingroup$ @ClaudeFrantz Welcome to DSP.SE! We need to avoid discussion in the comments but if I answered your question please accept it to close it out. If you have new questions just add those as new posts here! $\endgroup$ Commented Jul 9, 2024 at 14:43

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.