1 / 12

PLOTTING PHASE PORTRAITS WITH MATLAB:

Matlab code to plot phase portraits. L=1;g=9.81; [x1, x2] = meshgrid(-1:0.2:5, -2:0.2:2); x1dot = x2; x2dot = -g/L*sin(x1); quiver(x1,x2,x1dot,x2dot) xlabel('x_1') ylabel('x_2'). range for x 1. range for x 2. PLOTTING PHASE PORTRAITS WITH MATLAB:.

mburke
Download Presentation

PLOTTING PHASE PORTRAITS WITH MATLAB:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matlab code to plot phase portraits L=1;g=9.81; [x1, x2] = meshgrid(-1:0.2:5, -2:0.2:2); x1dot = x2; x2dot = -g/L*sin(x1); quiver(x1,x2,x1dot,x2dot) xlabel('x_1') ylabel('x_2') range for x1 range for x2 PLOTTING PHASE PORTRAITS WITH MATLAB: Phase portraits is a useful graphical tool to understand the stable or unstable behavior of the equilibrium points of a nonlinear systems. Consider the previous example,

  2. (-3,0) (0,0)

  3. l g Matlab code to plot phase portraits θ Equilibrium points: (0, 0) and (p, 0) L=1;g=9.81; [x1, x2] = meshgrid(-1:0.2:5, -2:0.2:2); x1dot = x2; x2dot = -g/L*sin(x1); quiver(x1,x2,x1dot,x2dot) range for x1 range for x2 m Unstable Stable Example:Consider the undamped simple pendulum

  4. (0,0) (p,0)

  5. l e1 m For l=1 m At the equilibrium, all derivatives are zero Consider the small perturbations around the equilibrium point θd=0 Nonlinear terms can be linearized using the Maclaurin series.

  6. m e1 l For θd=0 Higher order term clc;clear; A=[0 1;-9.81 0]; eig(A) ans = 0 + 3.1321i 0 - 3.1321i A Marginally stable For θd=p clc;clear; A=[0 1;9.81 0]; eig(A) ans = 3.1321 -3.1321 Unstable

  7. Initial conditions Initial conditions [0.1;0] [0.1;0]

  8. Example: Mathematical model of a nonlinear system is given by the equation Where f(t) is the input and x(t) is the output of the system. Find the equilibrium points for f=80 and linearize the system for small deviations from the equilibrium points. Find the response of the system The state variables are chosen as x1=x and x2=dx/dt=dx1/dt >>solve(‘64000*x1^2/(x1+2)=1.2’) x1d=0.00613, x2d=0 For the equilibrium condition x1=x1d+e1=0.00613+e1 x2=x2d+e2=e2

  9. x1=x1d+e1=0.00613+e1 x2=x2d+e2=e2 f=fd+u

  10. =0 =0 clc;clear; A=[0 1;-390.52 -9]; eig(A) ans = -4.5000 +19.2424i -4.5000 -19.2424i Stable system

  11. Matlab code for step input with magnitude 2 clc;clear a=[0 1;-390.52 -9];b=[0 0.015]';c=[1 0];d=0; sys=ss(a,b,c,d); t=[0:.025:2]; [y,t,x]=step(sys*2,t); plot(t,y,'--','Linewidth',2);axis([0 2 0 0.00015]);grid; xlabel('time (sec)');ylabel('Y output');title('Step Response') c=[0 1]

  12. u(t) 2 t e2 e2 e1 e1 u(t) 2 t We can obtain the same result using Simulink.

More Related