Using matlab to design Hz as a 6th order Butterworth filter
Using matlab to design H(z) as a 6th order Butterworth filter with bandedges of 0.3 and 0.5. Plot the frequency response of the above filter. Use the quantization function below to quantize the coefficients of the filter to 8 bits, and plot the frequency response. Implement H(z) in cascade form and quantize the coefficients to 8 bits, then plot the frequency response of the resulting filter. Compare the two approaches of implementing a filter and the effects of quantization on them. Plot the poles and zeros of all systems. Function from Mitra, \"Digital Signal Processing: A Computer Based Approach\". function beq = a2dT(d, n) % BEQ = A2DT(D, N) generates the decimal % equivalent beq of the binary representation % of a decimal number D with N bits for the % magnitude part obtained by truncation % m = 1; d1 = abs(d); while fix(d1) > 0 d1 = abs(d)/(2^m); m = m+1; end beq = fix(d1*2^n); beq = sign(d).*beq.*2^(m-n-1);
Solution
function beq = a2dT(d,n)
m=1;d1=abs(d);
while fix(d1)>0
d1 = abs(d)/(2^m);
m=m+1;
end
beq = fix(d1*2^n);
beq = sign(d).*beq.*2^(m-n-1);
end
[A,B,C,D] = butter(10,[500 560]/750);
d = a2dT(10,8)
sos = ss2sos(A,B,C,D);
fvt = fvtool(sos,d,\'Fs\',1500);
legend(fvt,\'butter\',\'designfilt\')
