資源簡介
這是一個最基本的自適應控制matlab例子,希望這個例子讓你理解什么是自適應控制。

代碼片段和文件信息
function?main()
%%?Main?Function
%?This?is?an?example?of?the?simulation?of?a?simple?adaptive?
%?control?system
%?Set?parameter
x0?=?1;?????????%?Initial?conidtion?for?the?state
theta0?=?[0;0];?%?Initial?condition?for?the?estimate
a?=?2;?b?=?3;???%?Parameters?unknown?to?the?controller
K?=?1;??????????%?controller?parameter
Gamma?=?diag([12]);????%?controller?parameter
%?Run?simulation
[ty]?=?ode45(@(tx)mySystem(txabKGamma)?...
????[0?100]?...??%?Simulation?time?span
????[x0;theta0]);
%?Create?figures
figure
subplot(311)
plot(ty(:1)tsin(t));
grid
legend({‘$x$‘‘$x_d$‘}‘Interpreter‘‘latex‘);
subplot(312)
plot(ty(:2)?[0?t(end)]?[a?a])
grid
legend({‘$\hat{a}$‘‘$a$‘}‘Interpreter‘‘latex‘);
subplot(313)
plot(ty(:3)??[0?t(end)]?[b?b])
grid
legend({‘$\hat{b}$‘‘$b$‘}‘Interpreter‘‘latex‘);
end
%%?The?function?describing?the?syetem?dynamics
function?dstate?=?mySystem(tstateabKGamma)
%?Extract?the?states
x?=?state(1);
htheta?=?state(2:3);
%?Create?the?reference?tracking?signal
xd?=?sin(t);
xdd?=?cos(t);
%?Compute?error
e?=?x?-?xd;
%?Formulate?the?controller
u?=?-Local_psi(x)*htheta?+?xdd?-?K*e;
dhtheta?=?Gamma*Local_psi(x)‘*e;
%?Main?dynamic?system
dx?=?-a*x*x?+?b*exp(-x)?+?u;
%?Combine?the?derivatives
dstate?=?[dx;?dhtheta];
end
%?Local?function
function?y?=?Local_psi(x)
y?=?[-x*x?exp(-x)];
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1411??2016-08-27?09:33??一個簡單的自適應控制matlab例子\adaptiveExample.m
?????目錄???????????0??2017-04-20?09:59??一個簡單的自適應控制matlab例子\
- 上一篇:MATLAB實現人體識別
- 下一篇:MATLAB 學生信息管理系統
評論
共有 條評論