image thumbnail

SimMechanics pendulum used for control optimization

by

 

31 Aug 2010 (Updated )

Pendulum imported via SimMechanics generates dynamics for optimal dampening solved by DIDO.

a=Arm_1DOF_Dynamics_Inv(x)
function a=Arm_1DOF_Dynamics_Inv(x)

a=zeros(size(x.states));
for jerry =1:length(x.nodes)
    theta_0=x.states(1,jerry); 
    omega_0=x.states(2,jerry); 
[t,State,Output]=sim('Arm_1DOF_1b',x.nodes(jerry)+[0;0.01;0.02],...
    simset('InitialState',[theta_0+0*pi/180, omega_0]),...
    [x.nodes(jerry)+[0;0.02],x.controls(jerry)+[0;0]]); 
a(:,jerry) = Output(1,:).';
end

Contact us