System simulation using Matlab, state plane plots

Similar documents
Lagrange s Equations of Motion and the Generalized Inertia

Simple and Physical Pendulums Challenge Problem Solutions

Matlab-Based Tools for Analysis and Control of Inverted Pendula Systems

The Inverted Pendulum

EE Homework 3 Due Date: 03 / 30 / Spring 2015

Phys 7221, Fall 2006: Midterm exam

Application of Neural Networks for Control of Inverted Pendulum

Lab 6a: Pole Placement for the Inverted Pendulum

Linearization problem. The simplest example

Torque and Simple Harmonic Motion

Review: control, feedback, etc. Today s topic: state-space models of systems; linearization

M2A2 Problem Sheet 3 - Hamiltonian Mechanics

EE 16B Midterm 2, March 21, Name: SID #: Discussion Section and TA: Lab Section and TA: Name of left neighbor: Name of right neighbor:

The dynamics of a Mobile Inverted Pendulum (MIP)

Problem Solving Session 10 Simple Harmonic Oscillator Solutions

Classical Mechanics. FIG. 1. Figure for (a), (b) and (c). FIG. 2. Figure for (d) and (e).

Lab 4 Numerical simulation of a crane

Inverted Pendulum. Objectives

SRV02-Series Rotary Experiment # 7. Rotary Inverted Pendulum. Student Handout

Dynamic Modeling of Rotary Double Inverted Pendulum Using Classical Mechanics

Design and Comparison of Different Controllers to Stabilize a Rotary Inverted Pendulum

4 Second-Order Systems

Figure 5.16 Compound pendulum: (a) At rest in equilibrium, (b) General position with coordinate θ, Freebody

STATE VARIABLE (SV) SYSTEMS

Harmonic Oscillator - Model Systems

The Acrobot and Cart-Pole

Rotational Kinetic Energy

Solution to phys101-t112-final Exam

Analysis of Linear State Space Models

In the presence of viscous damping, a more generalized form of the Lagrange s equation of motion can be written as

Physics Mechanics. Lecture 32 Oscillations II

Problem 1. Mathematics of rotations

MEAM 510 Fall 2011 Bruce D. Kothmann

Two-Dimensional Rotational Kinematics

Physics 6010, Fall 2016 Constraints and Lagrange Multipliers. Relevant Sections in Text:

Different Modelling and Controlling Technique For Stabilization Of Inverted Pendulam

P321(b), Assignement 1

PHYS2330 Intermediate Mechanics Fall Final Exam Tuesday, 21 Dec 2010

MCE 366 System Dynamics, Spring Problem Set 2. Solutions to Set 2

Control Systems Design, SC4026. SC4026 Fall 2009, dr. A. Abate, DCSC, TU Delft

THE REACTION WHEEL PENDULUM

MEAM 510 Fall 2012 Bruce D. Kothmann

El péndulo invertido: un banco de pruebas para el control no lineal. XXV Jornadas de Automática

AP Physics. Harmonic Motion. Multiple Choice. Test E

Static Equilibrium, Gravitation, Periodic Motion

ECE-320: Linear Control Systems Homework 8. 1) For one of the rectilinear systems in lab, I found the following state variable representations:

A Normal Form for Energy Shaping: Application to the Furuta Pendulum

Dynamical Systems & Lyapunov Stability

ROBOTICS Laboratory Problem 02

Version 001 circular and gravitation holland (2383) 1

Nonlinear Oscillators: Free Response

is conserved, calculating E both at θ = 0 and θ = π/2 we find that this happens for a value ω = ω given by: 2g

Clicker Quiz. a) 25.4 b) 37.9 c) 45.0 d) 57.1 e) 65.2

Swinging-Up and Stabilization Control Based on Natural Frequency for Pendulum Systems

Lecture 9: Eigenvalues and Eigenvectors in Classical Mechanics (See Section 3.12 in Boas)

Time Response of Dynamic Systems! Multi-Dimensional Trajectories Position, velocity, and acceleration are vectors

Topic # Feedback Control Systems

ACM/CMS 107 Linear Analysis & Applications Fall 2016 Assignment 4: Linear ODEs and Control Theory Due: 5th December 2016

Daba Meshesha Gusu and O.Chandra Sekhara Reddy 1

kx m x B N 1 C L, M Mg θ

Interactions Between Two Non-Stationary Pendulums

Unforced Oscillations

FALL TERM EXAM, PHYS 1211, INTRODUCTORY PHYSICS I Saturday, 14 December 2013, 1PM to 4 PM, AT 1003

Real-Time Implementation of a LQR-Based Controller for the Stabilization of a Double Inverted Pendulum

INPUT-STATE LINEARIZATION OF A ROTARY INVERTED PENDULUM

Numerics and Control of PDEs Lecture 1. IFCAM IISc Bangalore

θ + mgl θ = 0 or θ + ω 2 θ = 0 (2) ω 2 = I θ = mgl sinθ (1) + Ml 2 I = I CM mgl Kater s Pendulum The Compound Pendulum

Table of Contents 1.0 OBJECTIVE APPARATUS PROCEDURE LAB PREP WORK POLE-PLACEMENT DESIGN

Classical Mechanics Comprehensive Exam Solution

Linear control of inverted pendulum

. d. v A v B. e. none of these.

A. B. C. D. E. v x. ΣF x

Practice Problems for Final Exam

CP1 REVISION LECTURE 3 INTRODUCTION TO CLASSICAL MECHANICS. Prof. N. Harnew University of Oxford TT 2017

Apr 14, Calculus with Algebra and Trigonometry II Lecture 20More physics Aprapplications

28. Pendulum phase portrait Draw the phase portrait for the pendulum (supported by an inextensible rod)

paths 1, 2 and 3 respectively in the gravitational field of a point mass m,

Feedback Optimal Control for Inverted Pendulum Problem by Using the Generating Function Technique

Neural Network Control of an Inverted Pendulum on a Cart

Reverse Order Swing-up Control of Serial Double Inverted Pendulums

Chapter 14. Oscillations. Oscillations Introductory Terminology Simple Harmonic Motion:

ECEN 420 LINEAR CONTROL SYSTEMS. Lecture 6 Mathematical Representation of Physical Systems II 1/67

SWINGING UP A PENDULUM BY ENERGY CONTROL

Fundamentals Physics. Chapter 15 Oscillations

Lagging Pendulum. Martin Ga

ROTATIONAL DOUBLE INVERTED PENDULUM

= o + t = ot + ½ t 2 = o + 2

MSMS Matlab Problem 02

2.003 Quiz #1 Review

KINETIC ENERGY SHAPING IN THE INVERTED PENDULUM

Conservation of Energy

Mechatronic System Case Study: Rotary Inverted Pendulum Dynamic System Investigation

14.4 Energy in Simple Harmonic Motion 14.5 Pendulum Motion.notebook January 25, 2018

PHYS 1114, Lecture 33, April 10 Contents:

MEM04: Rotary Inverted Pendulum

Phys 7221 Homework # 8

PHY 141 Midterm 1 Oct 2, 2014 Version A

7 Pendulum. Part II: More complicated situations

Lecture 10. Example: Friction and Motion

Course Name: AP Physics. Team Names: Jon Collins. Velocity Acceleration Displacement

Transcription:

System simulation using Matlab, state plane plots his lab is mainly concerned with making state plane (also referred to as phase plane ) plots for various linear and nonlinear systems with two states he second part of this document presents the derivation of the differential equations which describe the dynamics of the inverted pendulum Problem ake for example the system described by the differential equation Denoting x = y, x = y we now write x = x x = α( x ) x x he equilibrium point is x =, x = he linear model of the system around this equilibrium point is x x x = α x y+ α( y ) y + y = he following Matlab code simulates the system and draws the resulting trajectories in the phase plane (state plane) function main clear all;close all;clc; nt=; % nt is the number of trajectories for k=:nt, x=[(rand(,)-5*[ ]')*]; % each one of the two initial states is %chosen randomly in the interval [-,+] =;tspan=[ ]; [t,x]= ode(@system,tspan,x); plot(x(),x(),'or',x(:,),x(:,)); end title('phase plane plot'); xlabel('x_'); ylabel('x_') function xdot=system(t,x) x=[x() x()]'; alpha=; xdot=[x(); -alpha*(x()^-)*x()-x()]; % xdot=[x(); - x()+alpha*x()]; % this is to be uncommented when the %simulation of the linear model of the system is desired a Run the simulation for various numbers of trajectories Are the trajectories moving toward or away from the equilibrium point? If they are moving toward (away of) the equilibrium point then it is a stable (unstable) equilibrium b Run the simulation for various values of α Notice how this parameter changes the shape of the trajectories

c Notice that the trajectories are converging to a closed orbit in the state space hat is a limit cycle Since the trajectories are converging towards it this means that it is a stable limit cycle Problem Consider the system described by the differential equation x = x y = x y a Calculate the equilibrium points bdetermine the linear model of the system around those equilibrium points c Simulate the two linear approximations of the nonlinear system and draw the phase plane plots One equilibrium point is stable while the other one is a saddle point he following figures present the results in the two cases Phase plane plot 5 x 5-5 - -5 - -5 5 5 x Figure State plane trajectories for the linear model around the stable equilibrium (,) Notice that for the linear model of the system, valid around this equilibrium point, this equilibrium is moved to the point (,) Phase plane plot 5 x 5-5 - -5 - -5 5 5 x Figure State plane trajectories for the linear model around the stable equilibrium (,-)

dsimulate the nonlinear system and draw the phase plane plot he next figure presents such a result Phase plane plot x - - - -4-5 -5 - -5 5 5 x Figure State plane trajectories for the nonlinear system Notice how in small regions around the two equilibrium points the phase plot for the nonlinear system resembles the ones obtained at part c he state trajectories go towards the equilibrium (,) from all directions he equilibrium (,-) is avoided on the direction of x while the trajectories are attracted to it on the direction of x he Matlab code which was used to obtain the previous figures is the following: function main clear all;close all;clc; nt=6; % nt is the number of trajectories for k=:nt, x=[(rand()-5)*; (rand())*-]; % each one of the two initial states is chosen randomly in a given interval =;tspan=[ ]; [t,x]= ode(@system,tspan,x); plot(x(),x(),'or',x(:,),x(:,)); end title('phase plane plot'); xlabel('x_'); ylabel('x_') function xdot=system(t,x) x=[x() x()]'; %xdot=[-x(); -x()^-x()^]; xdot=[- ; ]*x; %saddle point equilibrium %xdot=[- ; -]*x; %stable equilibrium

Problem Consider the system described by the differential equations x = x+ xx x = x xx a Calculate the equilibrium points b Determine the linear model of the system around those equilibrium points c Simulate the two linear approximations of the nonlinear system and draw the phase plane plots d Simulate the nonlinear system and draw the phase plane plot Problem 4 Simulate the following systems and draw the phase plane plot x = y( + x y ) a y = x( + y x ) x = y b y = x r = r( r) c θ = sin θ + ( r) In the case of part b you will see that the trajectories in the state plane are circles In the case of part c, plot the state trajectories in the plane (x,y) where x= rcos θ, y = r You will see that the equilibrium point in the origin is unstable and that all the state trajectories are attracted to a circular trajectory with radius equal to one (a stable limit cycle) 4

INVERED PENDULUM he inverted pendulum on a cart is representative of a class of systems that includes stabilization of a rocket during launch he position of the cart is p, the angle of the rod is θ, the force input to the cart is f, the cart mass is M, the mass of the bob is m, and the length of the rod is L he coordinates of the bob are (p,z ) p m θ L z g f M p In the following we derive the differential equations which describe the dynamics of the inverted pendulum system use Lagrange's equation he kinetic energy of the cart is K = Mp he kinetic energy of the bob is Inverted Pendulum K = m( p + z ) where p = p + L, z = L so that p = p + Lθ, z = Lθ herefore, the total kinetic energy is K = K + K = Mp + m( p + p θ L + L θ ) he potential energy is due to the bob and is U = mgz = mgl he Lagrangian is (note that on the left hand side of this equation L denotes the Lagrangian function while L in the right hand side is the constant length of the pendulum arm) L = K U = ( M + m) p + mlp θ + ml θ mgl 5

he generalized coordinates are selected as q = [ q ] q = [ p θ ] so that Lagrange's equations are d L L = f dt p p d L L = dt θ θ Substituting for L and performing the partial differentiation yields ( M + m) p + mlθ mlθ = f mlp + ml θ mgl = hese dynamical equations must now be placed into state-space form o accomplish this, write the Lagrange equation in terms of matrices as M + m ml p mlθ + f = ml ml θ mgl his is a mechanical system in typical Lagrangian form, with the inertia matrix multiplying the acceleration vector he term θ ml is a centripetal term and mgl is a gravity term Invert the inertia matrix and simplify to obtain mg mlθ f p = m cos θ ( M + m) ( M + m) g + mlθ + f θ = ml cos θ ( M + m) L Now, the state may be defined as x = [ x x x x ] [ ] = p p θ θ 4 and the input as u= f hen the nonlinear state equation may be written as x mg sin x cos x mlx4 sin x u m cos x ( M + m) x = = x4 ( M + m) g sin x + mlx4 sin x cos x + u cos x ml cos x ( M + m) L f ( x, u) Given these nonlinear state equations, it is very easy to simulate the inverted pendulum behavior on a computer We now want to linearize this and obtain the linear state equations he equilibrium point of interest is x= p p θ θ = [ ], where the rod is upright Instead of using the linearization method, for simplicity in this case we will use approximations which are valid near the origin sin x x,cos x In addition, all squared state components are very small and so set equal to zero his yields the linear state equation 6

x mgx u + mg x M M x M = + u = Ax + Bu x = 4 ( M + m) g ( M + m) gx u ML ML ML he output equation depends on the measurements taken, which depends on the sensors available Assuming measurements of cart position and rod angle, the output equation is p y = = x = h( x, u) θ he cart position may be measured by placing an optical encoder on one of the wheels, and the rod angle by placing an encoder at the rod pivot point It is difficult to measure the velocities p, θ, but this might be achieved by placing tachometers on a wheel and at the rod pivot point hen, the output equation will change Given the linear state-space equations, a controller can be designed to keep the rod upright hough the controller is designed using the linear state equations, the performance of the controller should be simulated in a closed-loop system using the full nonlinear dynamics x = f ( x, u) Problem 5 Write the Matlab code for the simulation of the inverted pendulum Present the results of the simulation, considering the initial state [ ] x = and u =, using a visual representation of the inverted pendulum in a similar fashion as in the case of the robotic arm from the previous laboratory session Note that this will be part of a future mini-project which will require simulation of the inverted pendulum system in the case when the control input is calculated using an optimal state feedback control law 7