【物理应用】matlab模拟分数模糊推理系统的倒立摆控制

1 内容介绍

讨论了一阶倒立摆控制系统的数学模型及其建立方法,并通过MATLAB的Simulink模型整定出一阶倒立摆双闭环PID控制系统的最优控制参数,最后对该系统的鲁棒性进行了仿真分析.

2 部分代码

%% The reference Papers

% Mehran Mazandarani, L. Xiu,Interval Type-2 Fractional Fuzzy Inference

% Before using FFIS.m read please carefully watch the video files and read

% the help file, Help_FFIS201210_updated.pdf.

%% The example of control of inverted pendulum system using FFIS

% This program is the first version of the function FFIS.m (FFIS_201210)

% The algorith of this function has not been written in an optimal manner.

% Thus, naturally, it may take more time than that one may expect for 

% getting the output.

% Based on the settings in this example, it takes several minutes to get 

% the output.

%% Initialize the Fuzzy system structure (Initialization Section) 

clc

clear

% close all

fis=readfis('fis');

%% Fractional Indices

%     Fids={value_1,form_1, value_2,form_2,...,value_m,form_m}

% Read the help_FFIS.pdf for more information about the cell arraye Fids. 

% fis.Outputs.MembershipFunctions

% In this example the following indices have been considered arbitrary. 

 Fids={0.5, 'a', 0.5, 'a', 1,'a', 0.5, 'b', 0.5,'b'};

% For Mamdani's FIS

%  Fids={1, 'a', 1, 'b', 1,'a', 1, 'b', 1,'b'}; 

%% Model (The main section)

T=3;

n=3000;

tspan=linspace(0,T,n+1);

h=tspan(2)-tspan(1);

% % This is the gain of control signal based on the control structure.

Kgain=220;

% % % % Pendulum parameters

g=9.8;

m=2;

M=8;

l=2;

% x1 is the angle of the pendulum and is used as the error

% x2 is the derivative of the x1, i.e. the derivative of the error

% % % % % % % % % % % % % % % % % %

% x1=theta;

% x2=theta_dot;

x1=zeros(1,n+1);

x2=zeros(1,n+1);

u=zeros(1,n);

x1(1)=0.3;  % the initial condition

x2(1)=0.1;  % the initial condition

a=1/(M+m);

% Model part

for cnt=1:n

Inputs=[x1(cnt); x2(cnt)];

% % % the control signal 

u(cnt)=FFIS(fis,Inputs,Fids);

u(cnt)=Kgain*u(cnt);

% %  The model has been considered in a descrete form by the use of 

% %  forward approximation of the derivative definition.

x1(cnt+1)=x1(cnt)+h*x2(cnt);

k1=g*sin(x1(cnt))-a*m*l*x2(cnt)^2*sin(2*x1(cnt))/2-a*cos(x1(cnt))*u(cnt);

k2=4*l/3-a*m*l*cos(x1(cnt))^2;

x2(cnt+1)=x2(cnt)+h*k1/k2;

end

figure(1)

plot(tspan(1:numel(x1)),x1,'LineWidth',2)

grid on

hold on

figure(2)

plot(tspan(1:numel(u)),u/Kgain,'LineWidth',2)

grid on

hold on

3 运行结果

4 参考文献

[1]胡全义, 黄士涛, 李洪洲,等. 自适应神经模糊推理系统在倒立摆控制中的应用[J]. 机电工程, 2007, 24(1):4.

博主简介:擅长智能优化算法神经网络预测信号处理元胞自动机图像处理路径规划无人机雷达通信无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值