Digital Signal Processing Reference
In-Depth Information
//BS2700.cof FIR bandstop coefficients designed with MATLAB
#define N 89
//number of coefficients
short h[N]={-14,23,-9,-6,0,8,16,-58,50,44,-147,119,67,-245,200,72,
-312,257,53,-299,239,20,-165,88,0,105,-236,33,490,-740,158,932,-1380,
392,1348,-2070,724,1650,-2690,1104,1776,-3122,1458,1704,29491,1704,
1458,-3122,1776,1104,-2690,1650,724,-2070,1348,392,-1380,932,158,-740,
490,33,-236,105,0,88,-165,20,239,-299,53,257,-312,72,200,-245,67,119,
-147,44,50,-58,16,8,0,-6,-9,23,-14};
FIGURE D.2. Coefficient file for an FIR bandstop filter centered at 2700 Hz designed using
MATLAB's filter designer SPTool ( bs2700.cof ).
Real-Time SPTool (RTSPTool)
Real-time SPTool (RTSPTool) provides a direct interface for the DSK [3-5] for
filter design and implementation (within the MATLAB environment) on the DSK
in real time. RTSPTool's window is similar to SPTool's filter designer window, with
additional toolbars to run the filter in real time on the DSK. Upon pressing an
appropriate toolbar, the filter is designed and the coefficients are scaled and saved
in an appropriate file that is included in a generic FIR program. MATLAB's file
filtdes.m was modified to provide that interface to the DSK. A MATLAB ( .m ) func-
tion accesses CCS code generation tools to compile/assemble, link, and load/run the
resulting executable file on the DSK (load/run using dsk6xldr filename.out ).
D.2 SPTool AND FDATool FOR IIR FILTER DESIGN
Section D.1 illustrates the design of FIR filters using MATLAB's SPTool and
FDATool . Some of the same procedures are used for the design of IIR filters as
well.
Example D.2: SPTool and FDATool for IIR Filter Design
SPTool
Figure D.3 a shows MATLAB's filter designer SPTool displaying the characteristics
of a 10th-order IIR bandstop filter centered at 1750 Hz. MATLAB shows the order
as 5, which represents the number of second-order sections. Save it as bs1750 (see
Example D.1). Export the coefficients to the workspace, as with the previous FIR
design. From MATLAB's workspace, type the following commands:
>>[z,p,k] = tf2zp(bs1750.tf.num, bs1750.tf.den);
>>sec_ord_sec = zp2sos(z,p,k);
>>sec_ord_sec = round(sec_ord_sec*2^15)
Search WWH ::




Custom Search