Error in GWO optimization algorithm
Show older comments
Question: 1) writing (Best_pos(1:4)) is right? because it gives me error that the dimensions of the array being concatenated [ParsListMain is 4 elements].
2) Why the Best_pos gives me the ub of the code which is [3.7,0.05,2.8,3.5]?
Thanks in advance.
[Best_score,Best_pos,GWO_cg_curve]= GWO(20,100,[3.6,0.045,2.7,3.4],[3.7,0.05,2.8,3.5],4,@ee_battery_lse);
% Update Battery block with optimized parameters
Pars = reshape([ParsListMain; cellstr(num2str('Best_pos(1:4)'))'],1,[]);
for k=1:2:length(Pars)
evalin('base',[Pars{k} '=' Pars{k+1} ';'])
end
% Display optimized parameters
fprintf(['Optimized parameters for the battery main ' ...
'dialog tab are:\n']);
fprintf('\t%5s = %s\n', Pars{:});
clear i_data v_data t_data T_data Ts
Accepted Answer
More Answers (0)
Categories
Find more on Energy Storage 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!