Respuestas (2)

madhan ravi
madhan ravi el 31 de Oct. de 2018

0 votos

Size of th is 500by 4 and size of phi is 5 by 1 how can you add them??

1 comentario

madhan ravi
madhan ravi el 31 de Oct. de 2018
lot of bugs first you need to explain your desired result with short example

Iniciar sesión para comentar.

KSSV
KSSV el 31 de Oct. de 2018

0 votos

Though the error is solved..you need to check your code...
close all;
th=[1 1 1 1]';
u(1)=1; y(1)=1; y(2)=1;
mu=1;
r(1)=10;
N=500;
th=zeros(4,N);
for k=2:N
r(k)=10;
ym(k+1)=0.4*y(k)+0.6*r(k);
u(k)=(1/th(1,k))*(-th(2,k)*u(k-1)-th(3,k)*y(k)-th(4,k)*y(k-1)+0.6*r(k));
y(k+1)=1.7*y(k)-0.7*y(k-1)+2*u(k)+0.6*u(k-1);
e(k+1)=y(k+1)-ym(k+1);
phi=[u(k) u(k-1) y(k) y(k-1)]';
th(:,k+1)=th(:,k)+mu*phi*e(k+1)./(1+phi'*phi);
end
plot(ym)
plot(r)
plot(u)
plot(y)
plot(th)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 31 de Oct. de 2018

Editada:

el 1 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by