Handouts and Code from Class
Posted: Thu Feb 24, 2011 6:33 pm
- twomass.m and twomassrhs.m from Monday 2/21.
- ex1.m, ex1rhs.m, ex2.m from Friday, 2/25.
- LQR programs from 3/2:
- lqrex.m
- threelqr.m
- threelqrrhs.m
- The command line stuff:
Code: Select all
sys = ss(A,B,C,D) [K,S,E] = lqr(sys,Q,R,[0 0 0 0 0 0]') threelqr close threelqr [K,S,E] = lqr(sys,10*Q,R,[0 0 0 0 0 0]') threelqr close threelqr lqrex Q(3,3) = Q(3,3)*40 [K,S,E] = lqr(sys,Q,R,[0 0 0 0 0 0]') threelqr
- Checking solutions with discontinuous forcing (3/11/11):
Code: Select all
close; clear; [t,y] = ode45(@stepfuncrhs,[0 5],[1]); plot(t,y); hold on; t = linspace(0,5,1000); myy = exp(-t) + (t-1).*(t>1) - (t-1-exp(-(t-2))).*(t>2); plot(t,myy,'r');
Code: Select all
function xdot = stepfuncrhs(t,x) if(t>1 & t<2) f = t; else f=0; end xdot = -x+f; end
- Block diagram algebra example problems from 4/3.