Constructs by linearization a linear state-space model from a general dynamical system described by a xcos diagram
sys= lincos(scs_m [,x0,u0 [,param] ])
Construct a linear state-space system by linearizing a model given as an xcos diagram. The idea is to transform a sub-diagram to a linear state-space model. The sub-diagram should have inputs and outputs.
The output is a Scilab data structure of type continuous-time state- space linear system.
// loading data
`exec`_("SCI/modules/xcos/tests/unit_tests/PENDULUM_ANIM.sci");
`exec`_("SCI/modules/xcos/tests/unit_tests/anim_pen.sci");
`loadXcosLibs`_(); `loadScicos`_();
`importXcosDiagram`_("SCI/modules/xcos/tests/unit_tests/pendulum_anim45.xcos");
// specific context data
M = 10;
m = 3;
l = 3;
ph = 0.1;
// looking for the Superblock to linearize
for i=1:`length`_(scs_m.objs)
if `typeof`_(scs_m.objs(i))=="Block" & scs_m.objs(i).gui=="SUPER_f" then
scs_m = scs_m.objs(i).model.rpar;
break;
end
end
sys = lincos(scs_m);
`bode`_(sys);