Define Operating Point SpecificationsBefore creating an operating point specification, configure the model to use the model
initial condition.set_param(mdl,'LoadExternalInput','off')
set_param(mdl,'LoadInitialState','off')Create a default operating point specification object.ops = operspec(mdl);Impose constraints on the outputs.ops.Outputs(1).Known = true(10,1);
ops.Outputs(1).y(1) = 0; % Bucket angle
ops.Outputs(1).y(3) = 50; % Upper angle
ops.Outputs(1).y(5) = -50; % Lower angle
ops.Outputs(1).y(7) = 0; % Base angle
ops.Outputs(1).y(9) = -45; % Support angleConfigure Trim OptionsConfigure trim optimizer options. Set the 'OptimizerType' option to 'graddescent-
proj', which is a projection-based trim optimizer that enforces consistency of the model
physical states. To display trim progress, set the 'DisplayReport' option to 'iter'.opt = findopOptions('OptimizerType','graddescent-proj',...
'DisplayReport','iter');
opt.OptimizationOptions.MaxFunEvals = 20000;Trim ModelFind the steady-state operating point that meets these specifications. The following
command takes a few minutes.[op,rpt] = findop(mdl,ops,opt);Optimizing to solve for all desired dx/dt=0, x(k+1)-x(k)=0, and y=ydes.(Maximum Error) Block
---------------------------------------------------------
(4.50000e+01) scdbackhoeTRIM/Out1
(3.88972e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support Arm Right/Revolute Joint Arm
(3.25130e+00) scdbackhoeTRIM/Plant/Backhoe Arm/Arm-Bucket Joint1 Steady-State Operating Points