52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
Y = [];
iterations = -1;
while (abs(error_old-error)>criterion)&&(iterations<max_iterations)
iterations = iterations + 1;
error_old_old = error_old;
error_old = error;
eval(sprintf("[t,y,y_theta] = mtt_s%s(system_name,theta,free);",method)); # Simulate system
error = 0;
J = zeros(n_th,1);
JJ = zeros(n_th,n_th);
for i = 1:n_y
E = weight(:,i).*(y(:,i) - y_s(:,i)); # Weighted error
error = error + (E'*E); # Sum the error
|
>
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
Y = [];
iterations = -1;
while (abs(error_old-error)>criterion)&&(iterations<max_iterations)
iterations = iterations + 1;
error_old_old = error_old;
error_old = error;
eval(sprintf("[t,y,y_theta] = mtt_s%s(system_name,theta,free);",method)); # Simulate system
plot(t,y(:,2:3));
error = 0;
J = zeros(n_th,1);
JJ = zeros(n_th,n_th);
for i = 1:n_y
E = weight(:,i).*(y(:,i) - y_s(:,i)); # Weighted error
error = error + (E'*E); # Sum the error
|