How can I fix the that error?
Show older comments
t=[0:0.1:5];
f=1;
n=2;
w=2*pi*f;
x1=cos(w*t);
e=2*pi*x1;
syms x1
int(x1,0,5);
phi=(1/2);
Lam=n*phi;
Answers (2)
madhan ravi
on 31 Oct 2018
0 votes
Size of th is 500by 4 and size of phi is 5 by 1 how can you add them??
1 Comment
madhan ravi
on 31 Oct 2018
lot of bugs first you need to explain your desired result with short example
KSSV
on 31 Oct 2018
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)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!