Home > other >  What is the difference between matlab impz and scipy impulse2
What is the difference between matlab impz and scipy impulse2

Time:10-13

I am doing some testing with filters in python. Already done it in matlab. When doing so I get different results for the same filter when using impz in matlab and scipy.signal.impulse2 in python. Matlab impz: Here is the result of the matlab filter And this is the result of the python implementation. python implementation To have the same I use this in both matlab and python for filter coefficents.

b = np.array([0.0335718093676408, 0, -0.0671436187352817, 0, 0.0335718093676408])
a = np.array([1,-1.74768237925094,2.19561759706246,-1.29097205253115,0.553269889688682])

And matlab code for doing this is just (this also creates the plot in matlab livescript):

impz(b,a)

The python code I have used is this:

T, yout = scipy.signal.impulse2((b,a))

and plot with:

plt.plot(T, yout)

I cant find anything in the docs that says that these should behave so differently

CodePudding user response:

impz and impulse2 are not the same function. impz deals with discrete time systems while impulse2 deals with a continous time system, the equivalent to impz is actully enter image description here

  • Related