I'm having trouble finding the group delay of a transfer function. I've seen a solved question on here about finding the group delay, but I want to understand why my method doesn't work.
Here is some sample code:
h = ButterworthFilterModel[3]
sss = h[I w][[1, 1]]
phase = Arg[sss]
groupDelay = -D[phase, w]
Table[groupDelay, {w, 0, 5, 0.1}]
The problem is that the group delay is giving complex numbers when I expect them to be real. The phase should be a real valued function, and if I test a few values, it indeed seems so. However, when I take the derivative, I start to get complex numbers again.