资源简介
运用模糊控制方法实现一级倒立摆稳定。里面有相应的源程序代码及其课件,简单易懂。
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 倒立摆平衡控制问题
% 模糊控制器(S函数)
% 2009/06
% 栗丽英(20081135)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[sysx0strts]=spacemodel(txuflag)
switch flag
case 0
[sysx0strts]=mdlInitializeSizes;
case 3
sys=mdlOutputs(txu);
case {249}
sys=[];
otherwise
error([‘Unhandled flag=‘num2str(flag)]);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[sysx0strts]=mdlInitializeSizes
sizes=simsizes;
% 连续状态个数
sizes.NumContStates =0;
% 离散状态个数
sizes.NumDiscStates =0;
% 输出值个数
sizes.NumOutputs =1;
% 输入值个数
sizes.NumInputs =2;
sizes.DirFeedthrough =1;
% 采样时间
sizes.NumSampleTimes =1;
sys=simsizes(sizes);
x0=[];
str=[];
ts=[0 0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function sys=mdlOutputs(txu)
x=[u(1);u(2)];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%load K_file;%
K1=[357.4135 45.3333];
K2=[341.4135 45.3333];
K3=[662.5861 102.6667];
K4=[680.4563 109.5949];
K5=[680.4563 95.7385];
ut1=K1*x;
ut2=K2*x;
ut3=K3*x;
ut4=K4*x;
ut5=K5*x;
% 辅初始值
h40=0;
h41=0;
h30=0;
h31=0;
h40=0;
h41=0;
h50=0;
h51=0;
h10=0;
h11=0;
h20=0;
h21=0;
L1=-pi/2;
L2=pi/2;
L=L2-L1;
N=2;
for i=1:N+1
e(i)=(L1+L/N*(i-1));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 定义模糊规则
h10=trimf(u(1)[e(1)e(2)e(3)]); %The middle
h11=trimf(u(2)[e(1)e(2)e(3)]); %The middle
if x(1)<0 x(2)>0
h50=trimf(x(1)[e(1)e(1)e(2)]); %The last
h51=trimf(x(2)[e(2)e(2)e(3)]); %The last
elseif x(1)>0 x(2)<0
h50=trimf(x(1)[e(2)e(2)e(3)]);
h51=trimf(x(1)[e(1)e(1)e(2)]);
end
if x(1)>0 x(2)>0
h40=trimf(x(1)[e(2)e(3)e(3)]); %The last
h41=trimf(x(2)[e(2)e(3)e(3)]); %The last
elseif x(1)<0 x(2)<0
h40=trimf(x(1)[e(1)e(1)e(2)]); %The last
h41=trimf(x(2)[e(1)e(1)e(2)]); %The last
end
if x(1)>0 x(2)=0
h30=trimf(x(1)[e(2)e(3)e(3)]); %The last
h31=trimf(x(2)[e(1)e(2)e(3)]); %The last
elseif x(1)<0 x(2)=0
h30=trimf(x(1)[e(1)e(1)e(2)]); %The last
h31=trimf(x(2)[e(1)e(2)e(3)]); %The last
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%h1+h2
ut=h10*h11*ut1+h30*h31*ut3+h40*h41*ut4+h50*h51*ut5;
%ut=ut1+ut2+ut3+ut4+ut5
%ut=ut1*5/13+ut2*2/13+ut3*2/13+ut4*2/13+ut5*2/13
sys(1)=8*ut;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10280 2009-06-15 13:11 6.倒立摆\chap4_10sim.mdl
文件 2793 2009-06-28 21:49 6.倒立摆\Control.m
文件 17427 2009-06-29 16:05 6.倒立摆\daolibai.mdl
文件 1426 2009-06-28 21:50 6.倒立摆\Plant.m
..A.SH. 5120 2009-06-29 18:29 6.倒立摆\Thumbs.db
文件 254464 2009-06-29 19:17 6.倒立摆\倒立摆.ppt
目录 0 2009-08-20 12:33 6.倒立摆
----------- --------- ---------- ----- ----
291510 7
相关资源
- 基于模糊控制的煤矿主井通风机不停
-
simuli
nk模糊控制 - 汽车底盘模糊控制和门限值控制控制
-
模糊控制simuli
nk模块的应用及教程 - 一阶双倒立摆论文终稿
- 单水箱的模糊控制+程序(程序原创)
- 基于LPC2124的温度模糊控制系统Proteu
- 模糊控制PID
- 一级倒立摆系统
- 用PLC实现模糊控制的两种程序设计方
- 倒立摆的神经网络控制
- 光伏逆变器模糊控制.rar
- 旋转倒立摆的毕业设计
- 一阶倒立摆实验报告设计
- 永磁同步电机智能PID控制
- 模糊控制洗衣机
- 基于双闭环PID控制的一阶倒立摆控制
- 模糊控制器设计
- 温度PID模糊控制的算法完整
- 倒立摆的上位机,使用串口通信,有
- 模糊控制课程期末答辩PPT及其仿真程
- MSP430旋转倒立摆程序
- 模糊控制mppt
- 基于模糊控制的光伏系统最大功率点
- 单片机控制电机(模糊控制 PID)
评论
共有 条评论