can anyone offer control of state space system using Iterative Learning Control in command window in MATALB

2 次查看(过去 30 天)
can anyone offer control of state space system using Iterative Learning Control in command window in MATALB
  4 个评论
Mohamed Eshag
Mohamed Eshag 2018-12-1
编辑:Mohamed Eshag 2018-12-1
Walter Roberson: Yeah, to distinguish from a Simulink solution, and ususally I like to design a control system in command window better than simulink

请先登录,再进行评论。

采纳的回答

Mark Sherstan
Mark Sherstan 2018-12-7
Here is an example that should push you in the correct direction. I havent completed it as I dont know what your reference signal is or if you need to add noise, disturbances, pure time delay, etc... but it is basically complete. Refer to the comments to follow what is going on.
function [ ] = ILC()
%[Ad Bd Cd Dd] = ssdata(sys);
Ad = [0 1 0; 3 0 1; 0 1 0];
Bd = [1; 1; 3];
Cd = [1 1 1];
Dd = [0];
% Set Ts, initial condition x0, time range t, pure time delay n0, relative
% degree r, and matrix size N
Ts = 1;
x0 = 0;
t = 0:Ts:60;
n0 = 0;
r = 1;
N = length(t);
% Define input vector U and reference J
U = [zeros(1,15) 10*ones(1,15) zeros(1,15) 10*ones(1,16)];
Rj = [zeros(1,15) 20*ones(1,15) zeros(1,15) 20*ones(1,16)]';
% G0 not formulated as initial condition is 0
% Formulate G
Gvec = zeros(N,1);
rvec = ((r-1):(N-n0-1))';
for ii = 1:length(rvec)
ApowVec = Ad^rvec(ii);
Gvec(ii) = Cd*ApowVec*Bd;
end
G = tril(toeplitz(Gvec));
% Set up ILC
jmax = 25;
l0 = 0.95;
q0 = 1;
L = l0 * eye(N,N);
Q = q0 * eye(N,N);
I = eye(N);
Uj = zeros(N,1); Ujold = Uj;
Ej = zeros(N,1); Ejold = Ej;
e2k = zeros(jmax,1);
% Run ILC and plot the response for each iteration
for ii = 1:jmax
Uj = Q*Ujold + L*Ejold;
Yj = G*Uj;
Ej = Rj - Yj; Ej(1) = 0;
Ejold = Ej;
Ujold = Uj;
plotter(ii,t,Ej,Yj,Uj,Rj,U)
e2k(ii) = Ej'*Ej;
end
end
function [] = plotter(ii,t,Ej,Yj,Uj,Rj,U)
figure(1)
% Plot the error Ej of the current itteration
subplot(1,3,1);
plot(t,Ej,'LineWidth',1.5);
title('Error, Ej','FontSize',16);
ylabel('Error Response','FontSize',16);
% Plot the input Uj of the current itteration
subplot(1,3,2);
plot(t,Uj,t,U,'-k','LineWidth',1.5);
title({['Iteration: ', num2str(ii)],'Input, Uj'},'FontSize',16);
xlabel('Time (s)','FontSize',16);
ylabel('Input Response','FontSize',16);
% Plot the output Yj of the current itteration
subplot(1,3,3);
plot(t,Yj,t,Rj,'-k','LineWidth',1.5);
title('Output, Yj','FontSize',16);
ylabel('Output Response','FontSize',16);
pause(0.1);
end
  2 个评论
Mohamed Eshag
Mohamed Eshag 2018-12-12
编辑:Mohamed Eshag 2018-12-12
Thanks Mr.Mark for your feedback. It will be usefull for me. please if you have good book in this area, could you send it yo me here ;( eshag10@yahoo.com). because I have two types of disturbances in my system.
mazin alseadi
mazin alseadi 2020-11-3
Dear Mohamed Eshag
Have you developed or did this codes to be worked successfuly ? if you did, so please could you kindly send me this files ?
with respect and appreciate

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Control System Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by