답변 (2개)

madhan ravi
madhan ravi 2018년 10월 31일

0 개 추천

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

댓글 수: 1

madhan ravi
madhan ravi 2018년 10월 31일
lot of bugs first you need to explain your desired result with short example

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

KSSV
KSSV 2018년 10월 31일

0 개 추천

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)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2018년 10월 31일

편집:

2018년 11월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by