Invertedpendulum倒立摆的matlab建模

合集下载

基于MATLAB的单级旋转倒立摆建模与控制仿真

基于MATLAB的单级旋转倒立摆建模与控制仿真

基于MATLAB的单级旋转倒立摆建模与控制仿真一、分析课题,选择数据源外文数据库多种多样,对于工程应用所研究的课题,通常选取比较常用的数据库为:IEEE Xplore(/Xplore/home.jsp)、Google学术搜索(/)以及SpringerLink(/)。

二、选取检索词单级旋转倒立摆的英文名称为:single rotational inverted pendulum,故以此为检索词进行检索。

三、构造检索式Single (and)rotational inverted pendulum四、实施检索,调整检索策略由于搜索步骤较多,此处只详细给出使用IEEE Xplore数据库的检索过程,另外两个数据库提供大概检索过程及结果截图。

由于搜索结果只有9条,数量较少,故调整检索词,过程如下:Google学术搜索:SpringerLink数据库:五、检索结果1、题目:Analysis of human gait using an Inverted Pendulum Model基于倒立摆模型的人体步态分析Zhe Tang ; Meng Joo Er ; Chien, C.-J. Fuzzy Systems, 2008. FUZZ-IEEE 2008. (IEEE World Congress on Computational Intelligence). IEEE International Conference onAbstract: IPM(Inverted Pendulum Model) has been widely used for modeling of human motion gaits. There is a common condition in most of these models, the reaction force between the floor and the humanoid must go through the CoG (Center of Gravity) of the a humanoid or human being. However, the recent bio-mechanical studies show that there are angular moments around the CoG of a human being during human motion. In other words, the reaction force does not necessarily pass through the CoG. In this paper, the motion of IPM is analyzed by taking into consideration two kinds of rotational moments, namely around the pivot and around the CoG. The human motion has been decomposed into the sagittal plane and front plane in the double support phase and single support phase. The motions of the IPM in these four different phases are derived by solving four differential equations with boundary conditions. Simulation results show that a stable human gait is synthesized by using our proposed IPM.摘要:IPM(倒立摆模型)已被广泛用于人体运动步态建模。

一阶倒立摆控制系统设计matlab

一阶倒立摆控制系统设计matlab

一阶倒立摆控制系统设计matlab一、控制系统简介控制系统是指通过对某些物理系统或过程的改变以获取期望输出或行为的一种系统。

其中涉及到了对系统的建模、分析以及控制方法的选择和设计等多方面的问题。

控制系统可以通过标准的数学和物理模型来描述,并可以通过物理或者仿真实验进行验证。

本文将围绕一阶倒立摆控制系统设计和仿真展开。

主要内容包括:1.一阶倒立摆系统简介2.系统建模3.系统分析4.设计控制器5.仿真实验及结果分析一阶倒立摆(controlled inverted pendulum)是一种比较常见的控制系统模型。

它的系统模型简单,有利于系统学习和掌握。

一般而言,一阶倒立摆系统是由一个竖直的支杆和一个质量为$m$的小球组成的。

假设球只能在竖直方向上运动,当球从垂直平衡位置偏离时,支杆会向相反的方向采取动作,使得小球可以回到平衡位置附近。

为了控制一阶倒立摆系统,我们首先需要对其进行建模。

由于系统并不是非常复杂,所以建模过程相对简单。

假设支杆长度为$l$,支杆底端到小球的距离为$h$,支杆与竖直方向的夹角为$\theta$,小球的质量为$m$,地球重力为$g$,该系统的拉格朗日方程可以表示为:$L =\frac{1}{2}m\dot{h}^{2}+\frac{1}{2}ml^{2}\dot{\theta}^{2}-mgh\cos{\theta}-\frac{1}{2}I\dot{\theta}^{2}$$I$表示支杆的惯性矩,它可以通过支杆的质量、长度以及截面积等参数计算得出。

$h$和$\theta$分别表示小球和支杆的位置。

我们可以通过拉格朗日方程可以得出系统的动力学方程:$b$表示摩擦系数,$f_{c}$表示对支杆的控制力。

由于一阶倒立摆会发生不稳定的倾斜运动,即未受到外部控制时会继续倾斜。

我们需要对系统加上控制力,使得系统保持在稳定的位置上。

在进行控制器设计之前,我们需要对系统进行分析,以便更好地了解系统在不同条件下的特性表现。

二级倒立摆的建模与MATLAB仿真

二级倒立摆的建模与MATLAB仿真
假设系统中的每一根摆杆都是匀质刚体驱动力与放大器的输入成正比且无延迟地直接作用于小车上并且可以在忽略实验中的库仑摩擦和动摩擦的前提下设定摆杆竖直向上时下摆杆角位移摆杆角位移均为零摆杆顺时针旋转为正
二级倒立摆的建模与 MATLAB 仿真 刘文斌,等
二级倒立摆的建模与MATLAB仿真
刘文斌,干树川 (四川理工学院电子与信息工程系 四川自贡,643000)
取为最小值。设控制输入函数形式为: U(t)= -Kx(t) (11) 状态反馈矩阵: K = R -1B T P ( 12) 其中,P 可由 Riccati 微分方程: (13) 其中, 性能指标函数: (14)
[J].计算机测量与控制,2006,14(12):1641 - 1642 5 张 春,江 明,陈其工等.平行单级双倒立摆系统的建模与滑
模变结构控制[J].2008.1
23
图1 二级倒立摆模型
(1)
(2)
(3) 经过线性化如下: (4)
(上接第 7 页) 0; 0; 0; 0]; p=eig(A) [num,den]=ss2tf(A,B,C,D,1); printsys(num,den) Q=[1000 0 0 0 0 0; 0 0 0 0 0 0; 0 0 10 0 0 0; 0 0 0 0 0 0; 0 0 0 0 10 0; 0 0 0 0 0 0]; Tc=ctrb(A,B); rank(Tc) To=obsv(A,C); rank(To) R=1; K=lqr(A,B,Q,R); Ac=[(A-B*K)]; Bc=[B]; Cc=[C]; Dc=[D]; T=0:0.005:20; U=0.2*ones(size(T)); [Y,X]=lsim(Ac,Bc,Cc,Dc,U,T); plot(T,Y(:,1),':',T,Y(:,2),' -',T,Y(:,3),'

matlab仿真毕设--倒立摆现代控制理论研究

matlab仿真毕设--倒立摆现代控制理论研究

内蒙古科技大学本科生毕业设计说明书(毕业论文)题目:倒立摆现代控制理论研究倒立摆现代控制理论研究摘要倒立摆系统是一个复杂的非线性、强耦合、多变量和自不稳定系统。

在控制工程中,它能有效地反映诸如可镇定性、鲁棒性、随动性以及跟踪性等许多控制中的关键问题,是检验各种控制方法的理想工具。

理论是工程的先导,它对倒立摆系统的控制研究具有重要的工程背景,单级倒立摆与火箭的飞行有关,二级倒立摆与双足机器人的行走有相似性,日常生活中的任何重心在上,支点在下的问题都与倒立摆的控制有极大的相似性,所以对倒立摆的稳定控制有重大的现实意义。

迄今,人们已经利用古典控制理论、现代控制理论及多重智能控制理论实现了多种倒立摆系统的稳定控制[5]。

倒立摆的控制方法有很多,如状态反馈控制,经典PID控制,神经网络控制,遗传算法控制,自适应控制,模糊控制等。

其控制方法已经在军工、航天、机器人和一般工业过程等领域得到了应用。

因此对倒立摆系统的控制研究具有重要的理论和现实意义,成为控制领域中经久不衰的研究课题。

本文是应用线性系统理论中的极点配置、线性二次型最优(LQR)和状态观测器等知识,设计了倒立摆系统线性化模型的控制器,通过MA TLAB仿真,研究其正确性和有效性。

通过分析仿真结果,我们知道了,状态反馈控制可以使倒立摆系统很好的控制在稳定状态,并具有良好的鲁棒性。

关键词:倒立摆;现代控制;Matlab仿真;Modern Control Theory Of Inverted PendulumAbstractInverted pendulum system is a complex nonlinear and strongly coupled,multi-variable and unstable system since.In control engineering,it can effectively reflect such stabilization,robustness,with the mobility of control and tracking,and many other key issue,It is the test ideal for a variety of control methods.Theory is the project leader,inverted pendulum control system also has important engineering research background,inverted pendulum with single-stage related torocket for the flight,Inverted pendulum and biped walking robot similar nature in any life in the center of gravity,the fulcrum in the next issue with the inverted pendulum control has a great similarity,so the stability control of inverted pendulum significant practical significance.So far,it has been the use of classical control theory,modern control theory and control theory of multiple intelligence to achieve a variety of inverted pendulum system stability control[5].Inverted pendulum control methods there are many,such as the state feedback control,the classic PID control,neural network control,genetic algorithm control,adaptive control,fuzzy control.The control method has been in military,aerospace,robotics and general industrial processes and other areas have been intended use.Therefore,the control of inverted pendulum system research has important theoretical and practical significance,of becoming enduring research topics in the field.This is the application of the theory of linear systems pole placement,linear quadratic optimal (LQR) and the state observer of such knowledge,the design of the linear inverted pendulum model of the controller,through simulation to study the correctness and effective sex.By analyzing the results of MATLAB simulation,state feedback control can make a goodcontrol of inverted pendulum system in a stable state,and has good robustness,stability control features.Key words: Inverted pendulum;Modern control;Matlab simulation;目录摘要 (I)Abstract (II)第一章绪论 (1)1.1倒立摆系统模型简介 (1)1.2倒立摆研究的背景与意义 (2)1.3国内外研究现状、水平和发展趋势 (3)1.3.1倒立摆和控制理论的发展 (3)1.3.2倒立摆的控制方法 (4)1.3.3倒立摆的发展趋势 (5)1.4本论文的主要工作介绍 (6)第二章一级倒立摆的数学模型建立及其性能分析 (7)2.1 系统的组成 (7)2.2 一级倒立摆数学模型的建立 (8)2.2.1 数学模型的建立 (8)2.2.2 系统的结构参数 (9)2.2.3 用牛顿力学方法来建立系统的数学模型 (9)2.2.4 一级倒立摆的性能分析[7] (13)2.3 本章小结 (15)第三章现代控制理论在倒立摆控制中的应用 (16)3.1 自动控制理论的发展历程 (16)3.2 经典控制理论 (18)3.2.1 PID控制现状 (18)3.2.2 PID控制的基本原理 (18)3.2.3 常用PID数字控制系统 (20)3.3 现代控制理论 (21)3.3.1 极点配置[11] (22)3.3.2 线性二次型最优的控制理论[7,8] (24)3.3.3 加权矩阵的选取 (26)3.3.4 状态观测器[7] (26)3.4 本章小结 (29)第四章MA TLAB仿真技术 (30)4.1 仿真软件——Matlab简介 (30)4.1.1 MA TLAB的优势 (30)4.2 Simulink简介 (32)4.3 S-函数简介 (33)4.3.1 用M文件创建S-函数 (34)4.4 倒立摆仿真模块的建立 (36)4.5 本章小结 (37)第五章一级倒立摆线性模型系统的仿真 (38)5.1 倒立摆控制器结构选择 (38)5.2 一级倒立摆线性模型系统仿真 (38)5.2.1 Simulink仿真 (42)5.3 本章小结 (46)结束语 (48)参考文献 (49)附录A (51)致谢 (53)第一章绪论1.1倒立摆系统模型简介倒立摆控制系统是一个复杂的、不稳定的、非线性的系统,是进行控制理论教学及开展各种控制实验的理想实验平台,但它并不是我们想象的那样抽象,其实在我们日常生活中就有很多这样的例子。

科研训练-基于MATLAB的直线一级倒立摆仿真系统研究

科研训练-基于MATLAB的直线一级倒立摆仿真系统研究

科研训练结题报告名称:基于MATLAB的直线一级倒立摆仿真系统研究小组成员:指导教师:1.直线一级倒立摆问题简介 (6)1.1背景简介【1】 (6)1.2软件特性 (6)1.3设计要求分析 (6)2. 数学模型的建立 (7)2.1 倒立摆受力分析 (7)2.2 微分方程的推导 (8)3.Simulink仿真模型 (9)3.1 Simulink仿真简介【2】 (9)3.2 初次模型搭建 (10)3.3 二次模型搭建 (11)3.4 二次模型优化 (12)3.5最终仿真模型及仿真结果 (13)4.封装子系统 (19)4.1 封装子系统简介 (19)4.2 封装子系统设置 (20)5. PID控制 (20)5.1 PID控制理论 (20)5.2 基于SIMULINK的PID控制器设计 (22)5.3 PID参数的确定 (24)6. 成果汇总与分析 (31)7. 经验总结与心得体会 (32)参考文献 (32)1.直线一级倒立摆问题简介1.1背景简介【1】倒立摆控制系统是一个复杂的、不稳定的、非线性系统,是进行控制理论教学及开展各种控制实验的理想实验平台。

对倒立摆系统的研究能有效的反映控制中的许多典型问题:如非线性问题、鲁棒性问题、镇定问题、随动问题以及跟踪问题等。

通过对倒立摆的控制,用来检验新的控制方法是否有较强的处理非线性和不稳定性问题的能力。

倒立摆的控制问题就是使摆杆尽快地达到一个平衡位置,并且使之没有大的振荡和过大的角度和速度。

当摆杆到达期望的位置后,系统能克服随机扰动而保持稳定的位置。

倒立摆是机器人技术、控制理论、计算机控制等多个领域、多种技术的有机结合,其被控系统本身又是一个绝对不稳定、高阶次、多变量、强耦合的非线性系统,可以作为一个典型的控制对象对其进行研究。

倒立摆系统作为控制理论研究中的一种比较理想的实验手段,为自动控制理论的教学、实验和科研构建一个良好的实验平台,以用来检验某种控制理论或方法的典型方案,促进了控制系统新理论、新思想的发展。

基于PID的倒立摆控制系统设计

基于PID的倒立摆控制系统设计

基于PID的倒立摆控制系统设计摘要:倒立摆(Inverted Pendulum)控制系统设计是控制理论教学中的一种典型的实验对象,具有很高的教学和科研价值。

本文基于PID控制算法,设计一个倒立摆控制系统,对倒立摆进行控制。

首先介绍了倒立摆系统模型和其动力学方程,然后详细介绍PID控制算法的原理和设计方法,并将其应用于倒立摆系统中,进行控制器的设计。

最后,通过MATLAB/Simulink软件进行系统仿真,并对仿真结果进行分析和讨论。

研究结果表明,PID控制算法能够有效地控制倒立摆系统,并且具有良好的控制性能和稳定性。

一、引言倒立摆控制系统是一种实验教学中常见的控制对象,其模型简单、控制复杂度适中,具有很高的教学和科研价值。

倒立摆系统被广泛应用于控制理论教学、控制算法研究以及控制系统设计等领域。

PID控制是一种常用的控制算法,具有简单、易实现、稳定性好等特点。

因此,本文将基于PID控制算法设计一个倒立摆控制系统,对倒立摆进行控制。

二、倒立摆系统模型和动力学方程倒立摆系统由一个竖直放置的杆和一个可沿杆轴线做直线运动的摆组成。

根据杆的位置和速度,可以得到倒立摆的状态变量,进而得到系统的动力学方程。

本文采用小角度近似,假设杆的运动范围很小,可以将其近似为线性系统,动力学方程可以表示为:$$(M+m)l\ddot{\theta}-ml\ddot{x}\cos(\theta)+m\sin(\theta)g=0$$$$\ddot{x}-\ddot{\theta}l=0$$其中,M为杆的质量,m为摆的质量,l为杆的长度,g为重力加速度,x为摆的位置,$\theta$为杆的倾斜角度。

三、PID控制算法原理和设计方法PID控制算法是一种基于误差信号的反馈控制算法,由比例控制、积分控制和微分控制三部分组成。

比例控制根据当前误差的大小进行控制;积分控制用于消除系统的稳态误差;微分控制用于预测误差的变化趋势,提高系统的响应速度和稳定性。

基于MATLAB的旋转倒立摆建模和控制仿真

基于MATLAB的旋转倒立摆建模和控制仿真

倒立摆系统作为一个被控对象具有非线性、强耦合、欠驱动、不稳定等典型特点,因此一直被研究者视为研究控制理论的理想平台,其作为控制实验平台具有简单、便于操作、实验效果直观等诸多优点。

倒立摆具有很多形式,如直线倒立摆、旋转倒立摆、轮式移动倒立摆等等。

其中,旋转倒立摆本体结构仅由旋臂和摆杆组成,具有结构简单、空间布置紧凑的优点,非常适合控制方案的研究,因此得到了研究者们广泛的关注[1-2]。

文献[3]介绍了直线一级倒立摆的建模过程,并基于MATLAB 进行了仿真分析;文献[4]通过建立倒立摆的数学模型,采用MATLAB 研究了倒立摆控制算法及仿真。

在倒立摆建模、仿真和研究中大多数研究者常用理论建模方法,也可以利用SimMechanics 搭建三维可视化模型仿真;文献[5]使用SimMechanics 工具箱建立旋转倒立摆物理模型,通过极点配置、PD 控制和基于线性二次型控制实现了倒立摆的平衡控制;文献[6]通过设计的全状态观反馈控制器来实现单极旋转倒立摆SimMechanics 模型控制,表明了SimMechanics 可用于不稳定的非线性系统;文献[7]通过单级倒立摆SimMechanics 仿真,研究了Bang-Bang 控制和LQR 控制对倒立摆的自起摆和平衡控制;文献[8]基于Sim⁃Mechanics 建立了直线六级倒立摆模型,并基于LRQ 设计状态反馈器进行了仿真控制分析。

本文首先采用Lagrange 方法建立了旋转倒立摆的动力学模型,在获得了旋转倒立摆动力学微分方程后建立了s-func⁃tion 仿真模型;然后,本文采用SimMechanics 建立了旋转的可视化动力学模型。

针对两种动力学模型,采用同一个PID 控制器进行了控制,从控制结果可以看出两种模型的响应曲线完全一致,这两种模型相互印证了各自的正确性。

1旋转倒立摆系统的动力学建模旋转倒立摆是由旋臂和摆杆构成的系统,如图1所示,旋臂绕固定中心旋转(角度记为θ)带动摆杆运动,摆杆可以绕旋臂自由转动,角度记为α。

倒立摆系统的建模及MATLAB仿真

倒立摆系统的建模及MATLAB仿真

(2)
方程 (1) , (2) 是非线性方程 ,由于控制的目的是 保持倒立摆直立 ,在施加合适的外力条件下 ,假定θ 很小 ,接近于零是合理的 。则 sinθ≈θ,co sθ≈1 。在 以上假设条件下 ,对方程线性化处理后 ,得倒立摆系 统的数学模型 :
( M + m) ¨x + mθl¨= f
(3)
Co nference , 1999 :230. [ 2 ] 王沉培 ,周艳红 ,周云飞. 复杂形状刀具磨削运动三维图 形仿真的研究. 中国机械工程 ,1998 ,10 (2) :1232126. [ 3 ] (美) 马尔金 1 S 著. 磨削技术理论与应用 [ M ]1 沈阳 :东 北大学出版社 ,20021
Key words inverted pendulum , model building , simulatio n under t he MA TL AB enviro nment
中图分类号 : TP273 文献标识码 :A
倒立摆系统是 1 个经典的快速 、多变量 、非线 性 、绝对不稳定系统 ,是用来检验某种控制理论或方 法的典型方案 。倒立摆控制理论产生的方法和技术 在半导体及精密仪器加工 、机器人技术 、导弹拦截控 制系统和航空器对接控制技术等方面具有广阔的开 发利用前景 。因此研究倒立摆系统具有重要的实践 意义 ,一直受到国内外学者的广泛关注 。
的稳态响应和瞬态响应特性由矩阵 A - B K 的特征
决定 。如果矩阵 K 选取适当 , 则可使矩阵 A - B K
构成 1 个渐近稳定矩阵 ,并且对所有的 x (0) ≠0 , 当
t 趋于无穷时 ,都可使 x ( t) 趋于 0 。称矩阵 A - B K
的特征值为调节器极点 。如果这些调节器极点均位
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

ECE451 Controll EngineeringInverted pendulum09/29/2013Introduction:Inverted pendulum is a typical fast, multi-varaibles, nonlinear, unstable system, ithas significant meaning. We choose the PID controller to fot the inverted pendulum. Assume the input is a step signal , the gravitational acceleration g=9.8m/s^2 and linearize the nonlinear model around the operating point.1.Mathematic ModlingM mass of the car 0.5 kgm mass of the pendulum 0.2 kgb coefficient of friction for cart 0.1 N/m/secl length to pendulum center of mass 0.3 mI mass moment of inertia of the pendulum 0.006 kg.m^2F force applied to the cartx coordinate of cart positionθpendulum angle from vertical (down)N and F are the force from horizontal and vertical direction.)Force analysisConsider the horizontal direction cart force, we get the equation:Consider the horizontal direction pendulum force, we get the equation:To get rid of P and N, we get this equation:Merge these two equations, about to P And N, to obtain a second motion equation:u to represent the controlled object with the input force F, linearized two motion equationsApply Laplace transform to the equation aboveThe transfer function of angle and positionLet v =put the equation above into the second equationWe get the transfer functionState space equation:Solve the algebraic equation, obtain solution as follows:Finally we get the system state space equations.2. PID Controller DesignWe now design a PID controller for the inverted pendulum system.KD(s) is the transfer function of the controller.G(s) is the transfer function of the controlled car.Considering that the input r(s) =0, the block diagram can be transformed as: The output of the system is()()()()()()()()()()()()()()()()sFnumnumPIDdendenPIDdenPIDnumsFdendenPIDnumnumPIDdennumsFsGskDsGsy+=+=+=11num —the numerator of the objectden —the denominator of the objectnumPID – the numerator of the PID controller transfer functiondenPID – the denominator of the PID controller transfer functionThe object transfer function is()()()()dennumsqbmglsqmglMmsqmlIbssqmlsUs=-+-++=Φ23242,in which[()()()]22mlmlIMmq-++=.PID Controller Transfer Function is()22sKsKsKsKKsKsKD IpDIPD++=++=Now, we add the car’s position as another output, we getin which G1 is the transfer function of the pendulum, G2 is the transfer function of the car.The output of the car’s position is()()()()()()()()()()sFdendenPIDnumnumPIDdennumsFsGsKDsGsX11221211+=+=in which, num1,den1,num2,den2 are separately mean the controlled object 1 and object 2 and PID controller‘s numerators and denominators.From ()()()s s g ml ml I s X Φ⎥⎦⎤⎢⎣⎡-+=22, we could get thatIn which,[()()()]22ml ml I M m q -++=.We can easily simplified the equation as()()()()()()()()s F num numPID k den denPID denPID num s X 12+=3. Matlab SimulationIn design, the cart's position will be ignored. Under these conditions, the design criteria are:1) settling time is less than 5 seconds2) pendulum should not move more than 0.05 radians away from the vertical When kd=1,k=1,ki=1:numc1=4.5455 0 0 0, denc1=1 4.7273 -26.6364 0.0909 0 0, num2= -1.8182 0 44.5455 0, denc2=1 4.7273 -26.6364 0.0909 0()()()()()()s qbmgl s q mgl M m s q ml I b s s qbmgls q ml I s U s X s G -+-++-+==2324222Then we tried many times to adjust the parameter to satisfy the requirements: Ts <=5 s and overshoot M<0.05.We find the optimal parameters of kd,k,ki which is the second situation.2. When kd=20,k=300,ki=1:Numc1= 4.5455 0 0 0, denc1=0.001 0.09111.3325 0.0001 0 0, numc2= -1.8182 0 44.5455 0, denc2=0.001 0.09111.3325 0.0001 0 0The results:Matlab codesM=0.5;m=0.2;b=0.1;I=0.006;g=9.8;l=0.3;q=(M+m)*(I+m*l^2)/q-(m*l)^2;num1=[m*l/q 0 0];den1=[1 b*(I+m*l^2)/q-(M+m)*m*g*l/q-b*m*g*l/q 0];num2=[-(I+m*l^2)/q 0 m*g*l/q];den2=den1;kd=1;k=1;ki=1;numPID=[kd k ki];denPID=[1 0];numci=conv (num1 denPID);denc1=polyadd(conv(denPID,den1),conv(numPID,num1)); t=0:0.1:20;figure(1)impulse(numc1,denc1,t)title(‘Angle’)figure(2)impulse(numc2,denc2,t)title(‘Position’)M=0.5;m=0.2;b=0.1;I=0.006;g=9.8;l=0.3;q=(M+m)*(I+m*l^2)/q-(m*l)^2;num1=[m*l/q 0 0];den1=[1 b*(I+m*l^2)/q-(M+m)*m*g*l/q-b*m*g*l/q 0]; num2=[-(I+m*l^2)/q 0 m*g*l/q];den2=den1;kd=20;k=300;ki=1;numPID=[kd k ki];denPID=[1 0];numci=conv (num1 denPID);denc1=polyadd(conv(denPID,den1),conv(numPID,num1)); t=0:0.1:20;figure(1)impulse(numc1,denc1,t)title(‘Angle’)figure(2)impulse(numc2,denc2,t)title(‘Position’)Simulation:We will build a closed-loop model with reference input of pendulum position and a disturbance force applied to the cart.We now begin to simulate the closed-loop system. The physical parameters are set as follows.M=0.5, m=0.2, b=0.1, I=0.006, g=9.8, l=0.3After 20s simulation, we see the response as followThe response is very much like what have been done in Matlab codes.。

相关文档
最新文档