blocks = frest.findSources(model)
blocks = frest.findSources(model,io)
finds
all timevarying source blocks in the signal path of any linearization
output point marked in the Simulink^{®} model blocks
= frest.findSources(model
)model
.
finds
all timevarying source blocks in the signal path of any linearization
output point specified in the array of linear analysis points blocks
= frest.findSources(model
,io
)io
.

String containing the name, in single quotes, of the Simulink model in which you are identifying timevarying source blocks for frequency response estimation. 

Array of linearization I/O points. The elements of 

Array of If you provide If you do not provide 
Estimate the frequency response of a model having timevarying
source blocks. This example shows the use of frest.findSources
to
identify timevarying source blocks that interfere with frequency
response estimation. You can also see the use of BlocksToHoldConstant
option
of frestimateOptions
to disable timevarying
source blocks in the estimation.
Load the model scdspeed_ctrlloop
.
mdl = 'scdspeed_ctrlloop'; open_system(mdl) % Convert referenced model to normal mode for accuracy set_param('scdspeed_ctrlloop/Engine Model',... 'SimulationMode','Normal');
First, view the effects of timevarying source blocks on frequency response estimation. To do so, perform the estimation without disabling timevarying source blocks.
In this example, linearization I/O points are already defined
in the model. Use the getlinio
command to get
the I/O points for frestimate
.
io = getlinio(mdl)
Define a sinestream signal and compute the estimated frequency
response sysest
.
in = frest.Sinestream('Frequency',logspace(1,2,10),... 'NumPeriods',30,'SettlingPeriods',25); [sysest,simout] = frestimate(mdl,io,in);
Perform exact linearization, and compare to the estimated response.
sys = linearize(mdl,io); bodemag(sys,sysest,'r*')
The estimated frequency response does not match the exact linearization. The mismatch occurs because timevarying source blocks in the model prevent the response from reaching steady state.
Find the timevarying blocks using frest.findSources
.
srcblks = frest.findSources(mdl);
srcblks
is an array of block paths corresponding
to the timevarying source blocks in the model. To examine the result,
index into the array.
For example, entering
srcblks(2)
returns the result
ans = Simulink.BlockPath Package: Simulink Block Path: 'scdspeed_ctrlloop/Engine Model' 'scdspeed_plantref/Drag Torque/Step1'
Now you can estimate the frequency response without the contribution
of the timevarying source blocks. To do so, set the BlocksToHoldConstant
option
of frestimateOptions
equal to srcblks
,
and run the estimation.
opts = frestimateOptions opts.BlocksToHoldConstant = srcblks % Run frestimate again with blocks disabled [sysest2,simout2] = frestimate(mdl,io,in,opts);
The frequency response estimate now provides a good match to the exact linearization result.
bodemag(sys,sysest2,'r*')
You can use the Simulink Model Advisor to determine whether timevarying source blocks exist in the signal path of output linear analysis points in your model. To do so, use the Model Advisor check "Identify timevarying source blocks interfering with frequency response estimation." For more information about using the Model Advisor, see Run Model Checks in the Simulink User's Guide.