matlab fi function fix points
hi all,
i have a question here and i am done with the first part on designing the bandpass filter by writing a matlab script below.
_________________________________________
% M file for bandpass FIR filter
ws1=0.3*pi
wp1=0.4*pi;
wp2=0.5*pi;
ws2=0.6*pi;
tr_width=min((wp1-ws1),(ws2-wp2));
M=ceil(6.6*pi/tr_width)+1
n=[0:1:M-1];
wc1=(ws1+wp1)/2;
wc2=(wp2+ws2)/2;
hd=ideal_lp(wc2,M)-ideal_lp(wc1,M);
w_ham=(hamming(M))';
h=hd.*w_ham;
[db,mag,pha,grd,w]= freqz_m(h,[1]);
delta_w=2*pi/1000;
Rp=-min(db(wp1/delta_w+1:1:wp2/delta_w)) % Actual passband ripple
As=-round(max(db(ws2/delta_w+1:1:501))) % Min stopband attenuation
%Plots
subplot(2,2,1); stem(n,hd); title('Ideal Impulse Response')
axis([0 M-1 -0.4 0.5]; xlabel('n'); ylabel('hd
')
axis([0 M-1 -0.4 0.5]); xlabel('n'); ylabel('hd
')
subplot(2,2,2); stem(n,w_ham); title ('Hamming Window')
axis([0 M-1 0 1.1]); xlabel('n'); ylabel('w
')
subplot(2,2,3); stem(n,h); title('Actual Impulse response')
axis([0 M-1 -0.4 0.5]); xlabel('n'); ylabel('h
')
subplot(2,2,4); plot(w/pi,db); axis([0 1 -150 10]);
title('Magnitude Response in dB'); grid;
xlabel('frequency in pi units'); ylabel('Decibels')
____________________________________________________
I am stuck in trying to proceed with the second part.
Qn1) how do i proceed with the 2nd part on determining the 12 bit fixed point representations of filter coefficients.
Qn2) and how do i plot the magnitude response of the fixed point filter in Matlab?
Please assist.
thanks
regards
scdoro