| Filter Design Toolbox | ![]() |
Compute the impulse response of quantized filters
Syntax
[h,t]=impz(hq) [h,t]=impz(hq,n) [h,t]=impz(hq,n,Fs) [h,t,ref] = impz(hq,...) impz(hq,...)
Description
[h,t] computes the response of the quantized filter hq to an impulse. = impz(hq)
impz returns the computed impulse response in the column vector h and the corresponding sample times in the column vector t (where t = [0:n-1]' and n = length(t) is computed automatically).
[h,t] computes n samples of the quantized impulse response for any positive integer n. In this case, = impz(hq,n)
t = [0:n-1]'. When n is a vector of integers, impz computes the impulse response at those integer locations, starting the response computation from 0 (and t=n or t=[0 n]). If, instead of n, you include the empty vector [] as the second argument, the number of samples is computed automatically.
[h,t] computes n samples and produces a vector = impz(hq,n,Fs)
t of length n so that the samples are spaced 1/Fs units apart.
[h,t,ref] = impz(hq,...) returns the impulse response of the quantized
filter and returns the impulse response of the reference filter in the vector hq in the column vector h,
ref.
impz(hq,...)
with no output arguments plots the impulse response of the reference filter associated with hq, and the quantized impulse response of quantized filter hq in a new figure window. impz uses stem for plotting the impulse responses.
Note
impz works for both real and complex quantized filters. When you omit the output arguments, only the real part of the impulse response is plotted.
|
Examples
Create a quantized filter for a fourth-order, low-pass elliptic filter with a cutoff frequency of 0.4 times the Nyquist frequency. Use a second-order sections structure to resist quantization errors. Plot the first 50 samples of the quantized impulse response, along with the reference impulse response.
% Specify transfer function parameters for the reference filter.
[b,a] = ellip(4,3,20,.6);
% Create a quantized filter from the reference filter. Convert the
quantized filter to second-order section form, order, and scale.
hq = sos(qfilt('ref',{b,a}));
Warning: 1 overflow in coefficients.
impz(hq,50)
Algorithm
impz applied to the quantized filter hq applies the filter command twice to a length n impulse sequence:
ReferenceCoefficients property value for hqQuantizedCoefficients property value for hqThe resulting plots use stem.
Warnings that occur with impz are a result of the filter command. In particular, you get an input overflow warning with impz when the InputFormat property value for the quantized filter hq is fixed-point and has only one bit to the left of the radix point.
For example, when your InputFormat property is set to {'fixed',[16,15]}, you get an input overflow warning when you implement impz.
See Also
filter Filter data through a quantized filter.
| iirpowcomp | initkalman | ![]() |