Frequency response estimate via filtering
[h,w] = freqrespest(sysobj,L)
[h,w] = freqrespest(sysobj,L,param1,value1,param2,value2,...)
[h,w] = freqrespest(sysobj,L,opts)
freqrespest(sysobj,...)
[h,w] = freqrespest(sysobj,L)
estimates
the frequency response of a filter System object™, sysobj
.
A set of input data is filtered and then forming the ratio between
output data and input data. The test input data comprises sinusoids
with uniformly distributed random frequencies.
Use this technique for comparing the performance of fixedpoint filters to that of another filter type. You can, for example, compare fixed—point frequency response estimate to that of a similar filter that uses quantized coefficients, but applies floatingpoint arithmetic internally. Such comparison determines whether the fixedpoint filter performance closely matches the floatingpoint, quantized coefficients version of the filter.
L
is the number of trials to use to compute
the estimate. If you do not specify this value, L
defaults
to 10. More trials generates a more accurate estimate of the response,
but require more time to compute the estimate.
h
is the estimate of the complex frequency
response. w
contains the vector of frequencies
at which h
is estimated.
[h,w] = freqrespest(sysobj,L,param1,value1,param2,value2,...)
uses
parameter value (PV) pairs as input arguments to specify optional
parameters for the test. These parameters are the valid PV pairs.
Enter the parameter names as input arguments in single quotation marks.
The following table provides valid parameters for [h, w]
.
Parameter Name  Default Value  Description 


 Number of FFT points to use. 

 Indicate whether to use normalized frequency or linear
frequency. Values are 

 Specify the sampling frequency when 

 Specify the spectrum range to be used as 

 Specify whether to set the center of the spectrum to
the DC value in the output plot. If you select 
Arithmetic  ARITH  Analyze the filter System object, based on the arithmetic
specified in the ARITH input. ARITH can
be set to double , single , or fixed .
The analysis tool assumes a doubleprecision filter when the arithmetic
input is not specified and the filter System object is in an unlocked
state. 
freqrespest
requires knowledge of the input
data type. Analysis cannot be performed if the input data type is
not available. If you do not specify the Arithmetic
parameter,
i.e., use the syntax [h,w] = freqrespest(sysobj)
,
then the following rules apply for this method:
The System object state is Unlocked
— freqrespest
performs
double precision analysis.
The System object state is Locked
— freqrespest
performs
analysis based on the locked input data type.
When you do specify the Arithmetic
parameter,
i.e., use the syntax [h,w] = freqrespest(sysobj,'Arithmetic',
ARITH)
, review the following rules for this method. Which
rule applies depends on the value you set for the Arithmetic
parameter.
Value  System Object State  Rule 

ARITH = 'double'  Unlocked  freqrespest performs doubleprecision analysis. 
Locked  freqrespest performs doubleprecision analysis.  
ARITH = ‘single'  Unlocked  freqrespest performs singleprecision analysis. 
Locked  freqrespest performs singleprecision analysis.  
ARITH = ‘fixed'  Unlocked  freqrespest produces an error because the
fixedpoint input data type is unknown. 
Locked  If the input data type is double or single, then freqrespest produces
an error because the fixedpoint input data type is unknown.  
When the input data is of fixedpoint type, freqrespest performs
analysis based on the locked input data type. 
The following Filter System objects are supported by this analysis function:
[h,w] = freqrespest(sysobj,L,opts)
uses
an object, opts
, to specify the optional input
parameters. This specification is not done directly by specifying
PV pairs as input arguments. Create opts
with
opts = freqrespopts(sysobj);
Because opts
is an object, you use set
to change the parameter values in opts
before
you use it with freqrespest
. For example, you could
specify a new sample rate with
set(opts,'fs',48e3); % Same as opts.fs=48e3
freqrespest(sysobj,...)
with
no output argument launches FVTool.
freqrespest
can also compute the frequency
response of doubleprecision floating filters. Such filters cannot
be converted to transferfunction form without introducing significant
round off errors which affect the freqz
frequency
response computation. Examples of these kinds of filters include statespace
or lattice filters, especially if they are highorder filters.