由于左侧的大小为1 x-14,右侧的大小为14 x-14,因此无法执行作业。
9次观看(最近30天)
显示较旧的评论
由于左侧的大小为1 x-14,右侧的大小为14 x-14,因此无法执行作业。
SSA中的错误(第87行)
tp = salppositions(i,:)> ub'; tm = salppositions(i,:)
main_ssa中的错误(第16行)
[Best_score,Best_pos,SSA_cg_curve]=SSA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
>>
接受的答案
沃尔特·罗伯森(Walter Roberson)
2021年10月6日
您的UB和LB需要是列向量,而不是行向量。
2条评论
沃尔特·罗伯森(Walter Roberson)
2021年10月6日
问题准备
DIM = 14;
ub = 1.1 *一个(dim,1);
lb = 0.05 * ones(dim, 1);
fobj = @ofun;
%--------------------------------------------------------------------------
searchagents_no = 20;%number of population
max_iteration = 1000;%number of iteration
%%
[Best_score,Best_pos,SSA_cg_curve]=SSA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
更多答案(2)
艾伦·魏斯(Alan Weiss)
2021年10月6日
错误的声明是明确的:你的任务(装备ality) statement has a 1-by-14 vector on the left and a 14-by-14 matrix on the right. Take a look at line 87 of your SSA function to see what is wrong. Are those the expected sizes of the variables?
艾伦·魏斯(Alan Weiss)
MATLABmathematical toolbox documentation