Simulink Control Design™ - MathWorks

(Tuis.) #1

'scdskyhogg/Vehicle System Model/Avionics/Autopilot/Theta Controller'};
set_param(blks{1},'Gain','0.0337283240400683k1')
set_param(blks{2},'Gain','-261.8699347622
k2')


Vary the values of k1 and k2 and linearize the model 20 times.


t = cputime;
for ct = 20:-1:1
k1 = 1+(ct-10)/100;
k2 = 1+(ct-10)/100;
sys_forloop(:,:,ct) = linearize(mdl,op,io);
end


View the total time to compute the 20 linearizations in seconds.


dt_for = cputime - t


dt_for =


84.7344


A factor that impacts this time is the total time it takes to compile and evaluate block
masks and resolve workspace parameters. To identify bottlenecks in your model
compilation, use the MATLAB Profiler.


Linearize Model By Passing Parameter Values to linearize


To pass the parameter values to linearize, specify the parameter names and values
using a structure.


More Efficient Batch Linearization Varying Parameters
Free download pdf