from Filter Implementation by Farhat Masood
Implementation of Filters.

[db,mag,w]=freqz_k(b,a);
function [db,mag,w]=freqz_k(b,a);
[H,w]=freqz(b,a,1000,'whole');
H=(H(1:1:501))';
w=(w(1:1:501))';
mag=abs(H);
db=20*log10((mag+eps)/max(mag));

Contact us at files@mathworks.com