Tags: design, designing, fdatool, filter, filterusing, fir, generated, implementation, isshown, kaiser, m-file, matlab, programming, window
FIR Filter Design & Implementation
On Programmer » Matlab
5,004 words with 0 Comments; publish: Wed, 07 May 2008 11:04:00 GMT; (20046.88, « »)
I'm quite new to MATLAB and I'm designing a Kaiser window filter
using the FDAtool (I have generated an m-file from this and it is
shown below). When I try to realise this into a model, I get the
error message "Input Bounds are out of range". Does anyone have any
idea why this is. All I want to do is feed a sinusoid through my
filter to verify it's performance with another block. How do I do
this?
Cheers
Duncan.
function Hd = Test
%TEST Returns a discrete-time filter object
%
% M-File generated by MATLAB(R) 7.0 and the Signal Processing Toolbox
6.2.
%
% Generated on: 10-Mar-2006 13:21:35
%
% FIR Window Lowpass filter designed using the FIR1 function.
% All frequency values are in Hz.
Fs = 44100; % Sampling Frequency
Fpass = 21858.45; % Passband Frequency
Fstop = 22040; % Stopband Frequency
Dpass = 5.7564627304e-008; % Passband Ripple
Dstop = 3.1622776602e-013; % Stopband Attenuation
flag = 'noscale'; % Sampling Flag
% Calculate the order from the parameters using KAISERORD.
[N,Wn,BETA,TYPE] = kaiserord([Fpass Fstop]/(Fs/2), [1 0], [Dstop
Dpass]);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, Wn, TYPE, kaiser(N+1, BETA), flag);
Hd = dfilt.dffir(b);
set(Hd, 'Arithmetic', 'fixed', ...
'coeffWordLength', 56, ...
'coeffAutoScale', true, ...
'productMode', 'Fullprecision', ...
'accumMode', 'Fullprecision', ...
'inputWordLength', 24, ...
'inputFracLength', 23, ...
'outputWordLength', 80, ...
'OutputMode', 'AvoidOverflow', ...
'signed', true, ...
'RoundMode', 'convergent', ...
'OverflowMode', 'Wrap');
denormalize(Hd);
set(Hd, 'Arithmetic', 'fixed', ...
'coeffWordLength', 52, ...
'coeffAutoScale', true, ...
'productMode', 'Fullprecision', ...
'accumMode', 'Fullprecision', ...
'inputWordLength', 24, ...
'inputFracLength', 23, ...
'outputWordLength', 80, ...
'OutputMode', 'AvoidOverflow', ...
'signed', true, ...
'RoundMode', 'convergent', ...
'OverflowMode', 'Wrap');
denormalize(Hd);
set(Hd, 'Arithmetic', 'fixed', ...
'coeffWordLength', 52, ...
'coeffAutoScale', true, ...
'productMode', 'Fullprecision', ...
'accumMode', 'Fullprecision', ...
'inputWordLength', 24, ...
'inputFracLength', 23, ...
'outputWordLength', 76, ...
'OutputMode', 'AvoidOverflow', ...
'signed', true, ...
'RoundMode', 'convergent', ...
'OverflowMode', 'Wrap');
denormalize(Hd);
set(Hd, 'Arithmetic', 'fixed', ...
'coeffWordLength', 52, ...
'coeffAutoScale', true, ...
'productMode', 'Fullprecision', ...
'accumMode', 'Fullprecision', ...
'inputWordLength', 24, ...
'inputFracLength', 20, ...
'outputWordLength', 76, ...
'OutputMode', 'SpecifyPrecision', ...
'outputFracLength', 74, ...
'signed', true, ...
'RoundMode', 'convergent', ...
'OverflowMode', 'Wrap');
denormalize(Hd);
set(Hd, 'Arithmetic', 'double');
set(Hd, 'Arithmetic', 'fixed', ...
'coeffWordLength', 52, ...
'coeffAutoScale', true, ...
'productMode', 'Fullprecision', ...
'accumMode', 'Fullprecision', ...
'inputWordLength', 24, ...
'inputFracLength', 20, ...
'outputWordLength', 76, ...
'OutputMode', 'SpecifyPrecision', ...
'outputFracLength', 74, ...
'signed', true, ...
'RoundMode', 'convergent', ...
'OverflowMode', 'Wrap');
denormalize(Hd);
set(Hd, 'Arithmetic', 'fixed', ...
'coeffWordLength', 52, ...
'coeffAutoScale', true, ...
'productMode', 'Fullprecision', ...
'accumMode', 'Fullprecision', ...
'inputWordLength', 24, ...
'inputFracLength', 23, ...
'outputWordLength', 76, ...
'OutputMode', 'AvoidOverflow', ...
'signed', true, ...
'RoundMode', 'convergent', ...
'
http://matlab.itags.org/q_matlab_18259.html
All Comments
Leave a comment...
- 0 Comments