The numerator of ‘N’ is complex, although the imaginary parts are vanishingly small (on the order of approximation error), so you can safely delete them. Add the ‘N.numerator’ assignment to your code just after the initial ‘N’ assignment, and it works (at least as far as I’ve tested it):
N=(P_s*(s-z1)*(s-z2))/((s-p1)*(s-p2));
N.numerator = real(N.numerator{:})); % <— ADD THIS ASSIGNMENT
