function H = L5_H(k, a, b)
% L5_H  Frequency response of 5th Order Modulator

k1 = k(1);  k2 = k(2);  k3 = k(3);  k4 = k(4);  k5 = k(5);
a1 = a(1);  a2 = a(2);  a3 = a(3);  a4 = a(4);  a5 = a(5);
b1 = b(1);  b2 = b(2);

z = tf('z', 1);
n3 = -4 + k2*a2;
n2 = -3*k2*a2 + k2*a3*k3 + k4*b2*k5 + k2*b1*k3 + 6;
n1 = 3*k2*a2 - 2*k2*a3*k3 - 4 + k2*a2*k4*b2*k5 + k4*k2*k3*a4 - 2*k4*b2*k5 - 2*k2*b1*k3;
n0 = 1 - k2*a2 + k2*b1*k3 + k4*b2*k5 + k4*b2*k5*k2*b1*k3 + k2*a3*k3 + k4*k2*k3*a5*k5 - k4*k2*k3*a4 - k2*a2*k4*b2*k5 + k2*a3*k3*k4*b2*k5;
d4 = -5;
d3 = k4*b2*k5 + k2*b1*k3 + 10;
d2 = -10 - 3*k2*b1*k3 - 3*k4*b2*k5;
d1 = k4*b2*k5*k2*b1*k3 + 5 + 3*k4*b2*k5 + 3*k2*b1*k3;
d0 = -k4*b2*k5 - 1 - k2*b1*k3 - k4*b2*k5*k2*b1*k3;
N =          z^4 + n3*z^3 + n2*z^2 + n1*z + n0;
D = z^5 + d4*z^4 + d3*z^3 + d2*z^2 + d1*z + d0;
H = k1 * N / D;