Cast fixed-point filter to use double-precision arithmetic
hd = double(h)
hd = double(h) returns
a new filter
hd that has the same structure and
h, but whose arithmetic property
is set to
double to use double-precision arithmetic
double(h) is not the same as the
hd, the filter returned by
the quantized coefficients of
h represented in
double-precision floating-point format
The reference filter returned by
double-precision, floating-point coefficients that have not been quantized.
You might find
double(h) useful to isolate
the effects of quantizing the coefficients of a filter by using
create a filter
hd that operates in double-precision
but uses the quantized filter coefficients.
Construct a Lowpass Filter
h = dfilt.dffir(firgr(27,[0 .4 .6 1],... [1 1 0 0]));
Set h to use fixed-point arithmetic to filter. Quantize the coeffs.
h.arithmetic = 'fixed';
Cast h to double-precision
hd = double(h);
Set up an input signal.
n = 0:99; x = sin(0.7*pi*n(:));
y = filter(h,x);
yd = filter(hd,x);
Compare the Fixed-point output with Floating-point output
FixedFloatNormDiff = 2.1234e-05