16.( LECTURE非 NUMERICAL5。LT0N 6 F NONLINEAR0 FFEREN升L EQATIONs
NUMERICAL SoL°To ·G川EN舟c。 MPLEX SET of0 YNAMICS 义(t)=斤(x,x) WHERE f()CouL0BE升MNLE升 R FUNCTI0N 工TCNB.工 MOss8 LE To ACTVALLY SoLVE FoR×(t)∈ ACTLY →0 EVELoP A则 UMERICAL SOLUTION. cA小NE0co0 ES TO HELP v5 D。TwsτN MATLAB BUT LET US CONSIDER THE BAsIcs APPROXIMATE THE DEKIUATIVES WITH BACKuARO 0氏 FFERENCES: 义(KT)(KT)-x(k-T T-SMALL FIxED T吨E化ERo0 K- INTEGER工心0EX 义(T)2文Kx)×((K-T) K-2Xk-1+×k
G-2 So,工 F UE WA0 =-3X-4X WJE COULD APP ROXIMATE THIS AS K-+xK-2 3×K-4Xk-xk- Xx-2Xx-I+ XK.-3T2XK-4T(xx-XK-1) 1+4T+3T2 k 2十4T)以k-1 k-2 X K 2+4T 了)Xk-二XK-2 13T2+4T CALLED A RECURSION KELAT0八 GWEN XK-l, XK-1 UE CAN FIND XK THEN USE XK-I Xx To FiND XK+ Mow 00 WE START? 工Fx()=4;×()-3 ()=4月ND×。-x-1=3T X4-3T SIMPLE AIPRo ACH BVT LIMITED ACcVkAcy KEEP T SMALL
C-3 8 16.61 -Numerical example for \ddot x 4 \dot x +3x=0 clear all T=0.05 号 actua1工C 号 start numerl.cs xml=x0-xOdot*T; NN=100; X=[xm1 x0] for li=3+[0: NN X(ii)=((4*+2)*X(ii-1)X(i-2))/(1+4*T+3*T~2) end 4 f );c1f sys=ss([01;-3-4],[01],[10],0 Y=initial(sys, [xo xOdot]',T*[0: NN]') 2.5 120
6-4 IN THE CASE THAT F( K) Is LINEAR, WE cA50凵 E THE E MATLAB USING L OFTEN FWD THAT LINEAR 0YN AMICS COUPLE 0 RE THA小 NE VARIA BLE >CAN ALWAYs WRITE THE Y NAMICS As X=升x+Bu WERE x TS A VECTOR of VARIABLES → CALLED THE STATE ExAMPLE: HILLS E& DATIONs FOR TWO CLsELy SPACEO SPACECRAFT: nw 2/a0 wins X=2 ∧+3n2×+fx ATR升CK 2^¥ RAOJAL LET文 0x+|00 久 2 2A D 0 LINEAR MATRIX FORM THAT CAN BE OIRECTLY s0LE0工 MATLA B
6-5 3 2 0 -5 1.5 -0.5 0.5 Ontrack Y X10 8 LSIM model propagated using LSIM 816,61 6 Jonathan How A=[0100;3*n^2002*n;0001;0-2*n00 B=[00;10;00;01]; D=zeros(2, 2)i Hills=ss(A, B, C, D) t time t=[0:01:5*pi]*90*60; s control inputs U=[ones(1 ength(t),2)*0];U(1,1)=1;U(1,2)=,01 g initial conditions X0=[0 号simu1 ations [Y, T] lsim(Hills, U, t, Xo) figure( plot(Y(:,2),Y(:,1)) label('Intrack Y') ylabel('Radial x')
function y=mgr 号16.61-MGR with radial MsD onboard 8 Prof. How 9 Call using lines at the bottom after the "return f nargin 1; w=2; end 0=1: g radial offset K=8: M=l, random model parameters g state space model of the dynamics g state is [R A=[01;-(2*K/M-w^2)0]; 号 weird matlab form Sys=SS(A, B, C, D) T=[0:.01:5] 8 Linear model SIMulation RR=lsim(sys, ones (size(T)),T) g basic offset is Ro, so y actual=RO+R figure(1);号c1f p1ot(T,R0+RR(:1),[min(T)max()],R0+R0/(2*K/M/w^2-1)*[11]," Linewidth',2); title(['Freg =' num2str(w)]) axis([min(T)max(r)0 1. 5*max(Rr(:,1))+RO]) xlabel('time) ylabel('R') return subplot (311); mgrl(1); subplot(312); mgr1(2): subplot(313)i mgr1(3.8)
eq c0.6 0.5 2.5 3.5 Freq=2 A5u↑,√↓ 0.5 15 2.5 3.5 time Freq= 3.8 0.5 1.5 2.5 3.5 4.5 time
68 IFF(x)工 S NONLINEAR THEN∈ HAVE To WORK JUST A BIT HARDER APPROXIMATE DIFFERENTAL EQVATIDW As BEFORE BUT WE LET MATLA8 WE HAVE SUPPLY I5 A ROGRAN丹 T CAN C0APTE义(=F(x;) GAVEN THE CURRENT VALVES OF X, x TE小CALL 0DE23 EXAMPLE:x+3×3=0 CUBIC SPRING . SX function [xdot] plant(t, x) 文=5(x) global n dot (1) (2); xdot(2)=-3*(x(1))^n; dot dot 'i eturn 8 call plant.m MIS PART global n x0=[-12] CALLS THE [T,x]=ode23(" plant',[012],x0); LIN EA艮 Of PAr n=1; subplot(211) 1ot(T,x(:,1),T1,x1(:,1),"--1); legend('Nonlinear,'Linear' label('x') label('Time') subplot(212) plot(T,x(:,2),T1,x1(:,2),--1) legend('Nonlinear,'Linear ylabel('V')
Linea 6 Time Nonlinear Linear 6 10 Time MATLAB is a trademark of The Mathwarks. nc