필터 지우기
필터 지우기

Iterative Learning Control (problem with Matlab code)

조회 수: 15 (최근 30일)
Nikos Apostolaras
Nikos Apostolaras 2018년 6월 17일
댓글: Olushijibomi Gbolade 2021년 7월 28일
I have the following linear plant:
y(t+1)= -0.7*y(t) - 0.12*y(t-1) + u(t)
y(0)=2
y(1)=2
In this system, u(t) is the input at time t, and y(t) is the output of the system at time t. The initial condition of the system also is represented with two simple equations.
I want to force the system to follow a square wave such as:
y_d(t)=2, 0<t<10
4, 11<t<20
2, 21<t<30
I know that the ILC algorithm works as follows but i can't figure out the script for Matlab:
1)consider y_d and the initial input (first iteration, k=0)
2)run the system with this input and keep the result (y_0)
3)compute the error as $latex e_0(t)=y_d(t)-y_0(t)
4)compute the next input using the previous result as: u_1(t)=u_0(t)+K_p*e_0(t+1)
use u_1(t) and jump to 2.
I have chosen K_p=0.5.

답변 (1개)

Hekma Sekandari
Hekma Sekandari 2018년 12월 11일
clear all;
close all;
clc;
y_d = ones(100)*2; % define the reference signal
% a step signal y_d=2 for t=1 to 30 s
u = ones(100)*0; % define first trial input
% input for the first trial it could be uo=0 or u0=y_d
y = ones(100)*0; % define initial conditions
trials = 100 ; % define the trials
Kp = 0.5 ; % define the gain Kp
% iteration loop
for j = 1:trials % j is trials index
for k = 3:30 % k is time index, 30 s is the final time
y(j,1) = 2; %initial conditions inside the loop for every iteration
y(j,2) = 2;
y(j,k) = -0.7*y(j,k-1)-0.12*y(j,k-2)+u(j,k-1);
e(j,k) = y_d(j,k)-y(j,k); % you must take care the sizes of the 2 vectors, y
% and y_d in order to the difference of the two be feasible! The size of y
% must be [trials(lines),final time(columns)]
u(j+1,k-1) = u(j,k-1)+Kp*e(j,k);
end
end
% plot in the same graph the reference input and the output y for each
% trial
plot(y_d(1,:),'or','LineWidth',5) % plot the 1est line and all the columns of vector y_d
hold all % hold all, holds several plots in the same graph
for w=1:trials
plot(y(w,:),'LineWidth',2) % plot for all trials
hold on
end
figure(2)
for w=1:trials
plot(e(w,:),'LineWidth',2) % plot for all trials
hold on
end
  댓글 수: 2
mazin alseadi
mazin alseadi 2020년 11월 3일
please I did this codes but I have this problem ! so could you kindly help me ?
Index exceeds matrix dimensions.
Error in ILC_internet (line 19)
e(j,k) = y_d(j,k)-y(j,k); % you must take care the sizes of the 2 vectors, y
Olushijibomi Gbolade
Olushijibomi Gbolade 2021년 7월 28일
Hello Hekma Sekandari,
Please I need to for a simple batch reaction
A + B =C (desired product)
C = D (undesired product
where the initial concentration of A, Cao =10, the initial concentration of B, Cbo=1.167, the initial concentration of C, Cco=0, volume of the reactor is 1, Temperature of the reactor is 50K
y=f(x0,u0)
I am working on my thesis which concentrated on comparing the effects of Iterative learning control and model predictive control on a simple batch reactor process.
I would appreciate any help I can get.
Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Classical Control Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by