• 简5123
    了解作者
  • matlab
    开发工具
  • 1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 3
    下载次数
  • 2021-04-24 17:10
    上传日期
专家控制 求二阶传递函数的阶跃响应 G(s)=133/(s^2+25s),取采样时间为1ms进行离散化。设计专家PID控制器,并进行Matlab仿真。
PID.zip
  • PID.m
    2KB
内容介绍
%专家PID控制 clc clear close ts = 0.001; %对象采样时间 sys = tf(133,[1,25,0]); %传递函数 dsys = c2d(sys,ts,'z'); %离散化 [num,den] = tfdata(dsys,'v');%得到参数num,den %设定初值 u_1 = 0.0;u_2 = 0.0;u_3 = 0.0; y_1 = 0;y_2 = 0;y_3 = 0; x = [0 0 0]'; x2_1 = 0; %设定比例、积分、微分环节系数 kp = 0.6;ki = 0.03;kd = 0.01; error_1 = 0;%设定误差初值 %循环5000次 for k = 1:1:5000 time(k) = k*ts; r(k)= 1.0; %输入信号 u(k)= kp*x(1)+kd*x(2)+ki*x(3); %PID控制器 %专家控制规则 %Rule1:开环控制 if abs(x(1))>0.8 u(k) = 0.45; elseif abs(x(1))>0.40 u(k) = 0.40; elseif abs(x(1))>0.20 u(k) = 0.12; elseif abs(x(1))>0.01 u(k) = 0.10; end %Rule2 if x(1)*x(2)>0||(x(2)==0) if abs(x(1))>=0.05 u(k)=u_1+2*kp*x(1); else u(k)=u_1+0.4*kp*x(1); end end %Rule3 if (x(1)*x(2)<0&&x(2)*x2_1>0)||(x(1)==0) u(k)=u(k); end %Rule4 if x(1)*x(2)<0&&x(2)*x2_1<0 if abs(x(1))>=0.05 u(k)=u_1+2*kp*error_1; else u(k)=u_1+0.6*kp*error_1; end end %Rule5:运用PI控制来消除误差? if abs(x(1))<=0.001 u(k)=0.5*x(1)+0.010*x(3); else %对输出器进行限制 if u(k) >= 10 u(k) = 10; end if u(k) <= -10 u(k) = -10; end %Linear model z变化后系统的线性模型 y(k)=-den(2)*y_1-den(3)*y_2+num(1)*u(k)+num(2)*u_1+num(3)*u_2; error(k) = r(k)-y(k); %系统误差表达式 %Return of parameters%每步计算的参数更新 u_2 =u_1;u_1 =u(k); y_2 =y_1;Dy_1 =y(k); x(1)= error(k); %Calculating P x2_1= x(2); x(2)= (error(k)-error_1)/ts; %Calculating D x(3)= x(3)+error(k)*ts; %Calculating I error_1 = error(k); end %循环结束 %绘图一 阶跃响应曲线 figure(1); plot(time,r,'b',time,y,'r'); xlabel('time(s)');ylabel('r,y'); %绘图二 误差响应曲线 figure(2); plot(time,r-y,'r'); xlabel('time(s)');ylabel('error');
评论
    相关推荐
    • Expert.rar
      Artificial intelligence--Expert system
    • Intelligent-Control.rar
      foundations of intelligent control
    • LECCO SQL Expert
      LECCO SQL Expert for sql server
    • Fuzzy Control Systems
      Chapter 8—Constraint-Oriented Fuzzy Control Schemes for Cart-Pole Systems by Goal Decoupling and Genetic Algorithms 1 Introduction 2 The Notion of Constraint-Oriented Fuzzy Control 3 ...
    • Expert Python Programming
      Expert Python Programming Copyright © 2008 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, ...
    • FUZZY CONTROL
      Robert Babuska, Delft University of Technology, Delft Center for Systems and Control Curator: Dr. Ebrahim Mamdani, Imperial College, London, UK Automatic control belongs to the application areas of ...
    • Control Expert v14.0 补丁
      Control Expert v14.0 补丁,,,,unity 14,为了方便广大调试工程师无可用软件的现况,该资源从网上找到.分享给大家.
    • Expert Python Programming
      Expert Python Programming
    • Expert Oracle Database Architecture
      Thomas Kyte写的好书,是英文版的。 讲的oracle 9i and 10g 设计开发的方案。
    • c++时尚编程百例__1-20.rar
      c++时尚编程百例__1-20