您现在的位置:首页 >> 智能控制 >> 内容

m通过matlab对比PID控制器,自适应PID控制器以及H无穷控制器的控制性能

时间:2023/2/19 20:32:54 点击:

  核心提示:08_021_m,包括程序操作录像+说明文档+参考文献...

1.完整项目描述和程序获取

>面包多安全交易平台:https://mbd.pub/o/bread/ZJWXk5xt

>如果链接失效,可以直接打开本站店铺搜索相关店铺:

点击店铺

>如果链接失效,程序调试报错或者项目合作可以加微信或者QQ联系。

2.部分仿真图预览





3.算法概述

     H∞控制是一种具有很好鲁棒性的设计方法,具有设计思想明确、控制效果好等优点,尤其适用于模型摄动的多输入多输出(MIMO)系统。H∞控制在控制理论、设计方法及应用等方面,经过多年不断发展和完善,已成为一种具有较完整体系的鲁棒控制理论。为适应控制系统稳定性、自适应性、智能化及工程化的更高要求,基于线性矩阵不等式(LMI)的H∞控制、非线性H∞控制以及H∞控制与神经网络和模糊控制结合,成为近年来H∞控制研究的热点。随着H∞控制研究的深入,其存在的诸如理论复杂、计算量大和参数摄动范围有限等问题将会逐步得到解决,适用范围也会更广、应用前景会更好。

4.部分源码

.......................................................................................

function edit3_Callback(hObject, eventdata, handles)

% hObject    handle to edit3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

 

% Hints: get(hObject,'String') returns contents of edit3 as text

%        str2double(get(hObject,'String')) returns contents of edit3 as a double

 

 

% --- Executes during object creation, after setting all properties.

function edit3_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit3 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called

 

% Hint: edit controls usually have a white background on Windows.

%       See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');

end

 

 

% --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

 

SEL  = get(handles.checkbox1,'Value');

kps  = str2num(get(handles.edit1,'String'));

kis  = str2num(get(handles.edit2,'String'));

kds  = str2num(get(handles.edit3,'String'));

Time = str2num(get(handles.edit5,'String'));

 

ts        = 0.001;

J         = 0.05;

q         = 0.1;

sys       = tf(1,[J,q,0]);

dsys      = c2d(sys,ts,'z');

[num,den] = tfdata(dsys,'v');

    

u_1       = 0;

u_2       = 0;

y_1       = 0;

y_2       = 0;

error_1   = 0;

ei        = 0;

kp        = zeros(Time/ts,1);

ki        = zeros(Time/ts,1);

kd        = zeros(Time/ts,1);

 

for k=1:1:Time/ts

    time(k)   =  k*ts;

    yd(k)     =  1;

    y(k)      = -den(2)*y_1-den(3)*y_2+num(2)*u_1+num(3)*u_2;

    error(k)  =  yd(k)-y(k);  

    derror(k) = (error(k)-error_1)/ts;

 

    %kp

    P_c1     = kps;

    tmpsp(k) = P_c1 + sech(error(k));   

    if SEL == 0

       kp(k)= kps;

    end

    if SEL == 1

       kp(k)= tmpsp(k);

    end 

    

    

    %kd

    P_d1     = kis;

    tmpsd(k) = P_d1 + sech(error(k));   

    if SEL == 0

       kd(k)= kis; 

    end

    if SEL == 1

       kd(k)= tmpsd(k); 

    end

    

    

    %ki

    P_i1   = kds;

    tmpsi(k) = P_i1 + sech(error(k));    

    if SEL == 0

       ki(k)= kds; 

    end

    if SEL == 1

       ki(k)= tmpsi(k); 

    end

    

    ei        = ei+error(k)*ts;

    u(k)      = kp(k)*error(k)+kd(k)*derror(k)+ki(k)*ei;

 

    %延迟,参数更新

    u_2       = u_1;

    u_1       = u(k);

    y_2       = y_1;

    y_1       = y(k);

    error_1   = error(k);

end

 

 

if SEL == 0

   save pidr1.mat time yd y  

end

if SEL == 1

   save pidr2.mat time yd y   

end

 

axes(handles.axes1);

plot(time,kp,'r');

xlabel('time(s)');

ylabel('kp');

axes(handles.axes3);

plot(time,kd,'r');

xlabel('time(s)');

ylabel('kd');

axes(handles.axes4);

plot(time,ki,'r');

xlabel('time(s)');

ylabel('ki');

 

axes(handles.axes2);

cla reset

plot(time,yd,'r',time,y,'k:','linewidth',2);

xlabel('time(s)');

ylabel('Position signal');

legend('Ideal position signal','Position tracking');

 

t1 = (max(y)-mean(yd))/mean(yd);

msgbox(['Over adjust: ',num2str(100*t1),'%','  Kp,Ki,Kd is:  ',num2str(kp(end)),'; ',num2str(ki(end)),'; ',num2str(kd(end))]);

 

 

% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton2 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

axes(handles.axes2);

cla reset

load pidr1.mat 

plot(time,y,'r:');

xlabel('time(s)');

ylabel('Position signal');

hold on

load pidr2.mat 

plot(time,y,'b:');

xlabel('time(s)');

ylabel('Position signal');

legend('initial kpkikd','adpative kpkikd');

 

 

function edit5_Callback(hObject, eventdata, handles)

% hObject    handle to edit5 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

 

% Hints: get(hObject,'String') returns contents of edit5 as text

%        str2double(get(hObject,'String')) returns contents of edit5 as a double

 

 

% --- Executes during object creation, after setting all properties.

function edit5_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit5 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called

 

% Hint: edit controls usually have a white background on Windows.

%       See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');

end

 

 

 

save Hinf.mat time yy   

% --- Executes on button press in pushbutton6.

function pushbutton6_Callback(hObject, eventdata, handles)

% hObject    handle to pushbutton6 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

axes(handles.axes2);

cla reset

load pidr1.mat 

plot(time,y,'r:');

xlabel('time(s)');

ylabel('Position signal');

hold on

 

load pidr2.mat 

plot(time,y,'b:');

xlabel('time(s)');

ylabel('Position signal');

load Hinf.mat 

plot(time,yy,'k');

xlabel('time(s)');

ylabel('Position signal');

legend('initial kpkikd','adpative kpkikd','H inf');

08_021_m

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168