0% found this document useful (0 votes)
38 views4 pages

All All: Adaptive Model Reference Controller Based On RLS Algorithm With Reference Signal R (T) 10 Cos (2 Pi n/50)

This document presents the results of two simulations of an adaptive model reference controller based on the recursive least squares (RLS) algorithm. In the first simulation, the reference signal is r(t)=10*cos(2*pi*n/50). In the second simulation, the reference signal is r(t)=2*randn. Both simulations estimate the controller parameters over 300 time intervals and plot the estimated parameters, error e(k), and other output signals.

Uploaded by

Jnsk Srinu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views4 pages

All All: Adaptive Model Reference Controller Based On RLS Algorithm With Reference Signal R (T) 10 Cos (2 Pi n/50)

This document presents the results of two simulations of an adaptive model reference controller based on the recursive least squares (RLS) algorithm. In the first simulation, the reference signal is r(t)=10*cos(2*pi*n/50). In the second simulation, the reference signal is r(t)=2*randn. Both simulations estimate the controller parameters over 300 time intervals and plot the estimated parameters, error e(k), and other output signals.

Uploaded by

Jnsk Srinu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Adaptive Model Reference Controller based on RLS algorithm with reference

signal r(t)=10*cos(2*pi*n/50)
close all;
clear all;
clc;
N=300; %interations
n=1:N+1; % time intravals
r=10*cos(2*pi*n/50) ;% system reference signal
u=[0 0]; %initial inputs
uf=[0 0]; %initial filter inputs
ym=[0 0 0]; %initial reference outputs
y=[0 0 0]; %initial output
yf=[0 0 0]; % initial filter outputs
th_0=[1 0.4 -2.5316 1.4493]; % system parameters
th=[0 0 th_0(1) ;0 0 th_0(2);0 0 th_0(3);0 0 th_0(4)];
p=0.7*eye(4); % Identity matrix
for t=3:N-1
r0h(t+1)=th_0(1);
r1h(t+1)=th_0(2);
s0h(t+1)=th_0(3);
s1h(t+1)=th_0(4);
ym(t+1)=0.4177*r(t)+1.0316*ym(t)-0.4493*ym(t-1);
uf(t)=1/r0h(t+1)*(-r1h(t+1)*uf(t-1)-s0h(t+1)*yf(t)-s1h(t+1)*yf(t-1)+ym(t+1));
phi=[uf(t); uf(t-1);yf(t); yf(t-1);];
u(t)=uf(t)-1.0316*uf(t-1)+0.4493*uf(t-2);
y(t+1)=-1.5*y(t)+y(t-1)+u(t)+0.4*u(t-1);
yf(t+1)=y(t+1)+1.0316*yf(t)-0.4493*yf(t-1);
e(t+1)=y(t+1)-ym(t+1);
p=p-p*phi*phi'*p/(1+phi'*p*phi);
th(:,t+1)=th(:,t)+p*phi*e(t+1);
end
figure;
subplot(311);plot(th');title('controller parameters'),grid on;
grid on;
subplot(312);plot(e,'k');title('error e(k)'),grid on;
grid on;

Adaptive Model Reference Controller based on RLS algorithm with reference


signal r(t)=2*randn
close all;
clear all;
clc;
N=300; %interations
n=1:N+1; % time intravals
r(n)=2*randn;% system reference signal
u=[0 0]; %initial inputs
uf=[0 0]; %initial filter inputs
ym=[0 0 0]; %initial reference outputs
y=[0 0 0]; %initial output
yf=[0 0 0]; % initial filter outputs
th_0=[1 0.4 -2.5316 1.4493]; % system parameters
th=[0 0 th_0(1) ;0 0 th_0(2);0 0 th_0(3);0 0 th_0(4)];
p=0.7*eye(4); % Identity matrix
for t=3:N-1
r0h(t+1)=th_0(1);
r1h(t+1)=th_0(2);
s0h(t+1)=th_0(3);
s1h(t+1)=th_0(4);
ym(t+1)=0.4177*r(t)+1.0316*ym(t)-0.4493*ym(t-1);
uf(t)=1/r0h(t+1)*(-r1h(t+1)*uf(t-1)-s0h(t+1)*yf(t)-s1h(t+1)*yf(t-1)+ym(t+1));
phi=[uf(t); uf(t-1);yf(t); yf(t-1);];
u(t)=uf(t)-1.0316*uf(t-1)+0.4493*uf(t-2);
y(t+1)=-1.5*y(t)+y(t-1)+u(t)+0.4*u(t-1);
yf(t+1)=y(t+1)+1.0316*yf(t)-0.4493*yf(t-1);
e(t+1)=y(t+1)-ym(t+1);
p=p-p*phi*phi'*p/(1+phi'*p*phi);
th(:,t+1)=th(:,t)+p*phi*e(t+1);
end
figure;
subplot(311);plot(th');title('controller parameters'),grid on;
grid on;
subplot(312);plot(e,'k');title('error e(k)'),grid on;
grid on;

Adaptive Model Reference Controller based on RLS algorithm with reference


signal r(t)=10*cos(2*pi*n/50) outputs

Adaptive Model Reference Controller based on RLS algorithm with reference


signal r(t)=2*randn outputs

You might also like