No BSD License  

Highlights from
nlcontrol

nlcontrol

by

 

Nonlinear algorithm for controlling dynamical systems, particularly where linear methods fail.

pend_sim(s,F,dt)
function sn = pend_sim(s,F,dt)
%  Simulates pendulum
%  Copyright (c) The University of Texas at Austin


l = 0.5;	
M = 0.75;
dyn_fr = 0.1;  %Dynamic friction
g = 9.81;

F = F - dyn_fr*s(2);

t(2) = s(2) + dt*(F-M*g*sin(s(1)))/(l*M);
t(1) = s(1) + dt*s(2);  
%t(1)=rem(t(1),2*pi);

sn = t';




Contact us