نشد باز!
اشتباه میذارم؟
این تابعی که باید با ژنتیک اجرا بشه :
function [ p ] = sys_performance( K )
global natayej;
global index;
kp1 = K(1,1);
ki1 = K(1,2);
kd1 = K(1,3);
L1 = abs(K(1,4));
M1 = abs(K(1,5));
natayej(index) = [kp1 , ki1 , kd1 , L1 , M1 ];
index = index + 1;
set_param('exam2/FOPID1',...
'kp', num2str(kp1) ,'ki', num2str(ki1),'kd', num2str(kd1),...
'vi',num2str(-L1),'vd', num2str(M1))
simout=sim('exam2');
p = ITAE;
end
و این کد اصلی که من اجراش میکنم :
clc
clear all
tic
global natayej;
global index;
natayej = {};
index = 1;
load_system('exam2')
options=gaoptimset('PlotFcn', @gaplotbestf, 'Display','iter');
K_opt = ga(@sys_performance, 5 , [], [], [], [],...
[0.01 , 0.01 , 0.01 , 0.01 , 0.01 ] ,...
[30 , 60 , 100 , 1.2 , 1 ], [], options);
toc
این پیغام رو میده :
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> sys_performance at 15
natayej(index) = [kp1 , ki1 , kd1 , L1 , M1 ];