Documentation

generatetbstimulus

产生高密度脂蛋白试验台的刺激

Syntax

dataIn = generatetbstimulus(filtSO,'InputDataType',nt)
dataIn = generatetbstimulus(filterObj)
dataIn = generatetbstimulus(___,Name,Value)

Description

example

dataIn= generatetbstimulus(filtSO,'InputDataType',nt)generates a test bench stimulus for the specified filter System object™ and the input data type, specified bynt.

The coder chooses a default set of stimuli, depending on your filter type. The default set is{'impulse','step','ramp','chirp','noise'}. For IIR filters,'impulse'and“步骤”are excluded.

dataIn= generatetbstimulus(filterObj)generates a test bench stimulus for the specifieddfiltfilter object.

dataIn= generatetbstimulus(___,Name,Value)uses optional name-value pair arguments, in addition to any of the input arguments in previous syntaxes. Use these options to change the default set of stimuli used by the coder.

Examples

collapse all

Design a lowpass filter and construct a direct-form FIR filter System object™,fir_lp.

filtdes = fdesign.lowpass('N,Fc,Ap,Ast',30,0.4,0.05,0.03,'linear'); fir_lp = design(filtdes,'FilterStructure','dffir','SystemObject',true);

Generate test bench input data. The call togeneratetbstimulusgenerates ramp and chirp stimuli and returns the results. Specify the fixed-point input data type as anumerictypeobject.

rc_stim = generatetbstimulus(fir_lp,'InputDataType',numerictype(1,12,10),'TestBenchStimulus',{'ramp','chirp'});

Apply the quantized filter to the data and plot the results. The call to thestepfunction computes the filtered response to the input stimulus. The input data for the step function must be a column-vector to indicate samples over time. A row-vector would represent independent data channels.

plot(step(fir_lp,rc_stim'))

Input Arguments

collapse all

Filter for which to generate a test bench stimulus, specified as a filter System object. For an overview of supported filter types, seeGenerate HDL from Filter System Objects. To create a filter System object, use its constructor or thedesignfunction.

Input data type, specified as anumerictypeobject. This argument applies only when the input filter is a System object. Callnumerictype(s,w,f), wheresis 1 for signed and 0 for unsigned,wis the word length in bits, andfis the number of fractional bits.

Filter for which to generate a test bench stimulus, specified as adfiltobject. You can create this object by using thedesignfunction. For an overview of supported filter features, seeFilter Configuration Options.

Name-Value Pair Arguments

Specify optional comma-separated pairs ofName,Valuearguments.Nameis the argument name andValueis the corresponding value.Namemust appear inside single quotes (' '). You can specify several name and value pair arguments in any order asName1,Value1,...,NameN,ValueN.

Example:'TestBenchStimulus',{'ramp','impulse'}

collapse all

Input stimuli that the generated test bench applies to the filter, specified as the comma-separated pair consisting of'TestBenchStimulus'and'impulse',“步骤”,'ramp','chirp', or'noise'. You can specify combinations of these stimuli in a cell array, in any order.

You can also specify a custom input vector by using theTestBenchUserStimulusproperty. WhenTestBenchUserStimulusis a non-empty vector, it takes priority overTestBenchStimulus.

Example:'TestBenchStimulus',{'ramp','impulse','noise'}

Custom vector of input data that the generated test bench applies to the filter, specified as the comma-separated pair consisting of'TestBenchUserStimulus'and the empty vector or a function call that returns a vector. When this argument is set to the empty vector, the test bench uses theTestBenchStimulusproperty to generate input data.

For example, this function call generates a square wave with a sample frequency of 8 bits per second (Fs/8).

repmat([1 1 1 1 0 0 0 0],1,10)
Specify this stimulus when you callgeneratetbstimulus.
generatetbstimulus(filt,'InputDataType',numerictype(1,16,15),...“GenerateHDLTestbench”,'on',...'TestBenchUserStimulus',repmat([1 1 1 1 0 0 0 0],1,10))

Output Arguments

collapse all

Test bench stimulus for the filter, returned as asingle,double, orfiarray. If the input filter is adfiltfilter object, the results are quantized using the arithmetic property of the filter object. If the input filter is a filter System object, the stimulus is quantized bynt.

Introduced before R2006a

Was this topic helpful?