The problem is that i am getting negative values of kp and ki, how i can get value in specific range?
9 次查看(过去 30 天)
显示 更早的评论
function F = tracklsq(pid)
syms x;
limit_1 = 0;
limit_2 = 10;
Area = int(x,limit_1, limit_2);
Kp = pid(1);
Ki = pid(2);
z=Kp*0.1+Ki*0.1*Area; %objective function
sys_overshoot=z-1; % compute the overshoot
alpha=10;beta=10;
F=0.1*2*beta+sys_overshoot*alpha;
end
PSO code is attached
0 个评论
回答(1 个)
Walter Roberson
2017-7-10
Your pso code has
current_position = 10*(rand(dim, n)-.5);
rand() is going to be in the range 0 to 1, so rand() - 0.5 is going to be in the range -0.5 to +0.5; 10 times that would be -5 to +5 .
If you do not want negative inputs, then do not subtract .5 in this statement.
8 个评论
Walter Roberson
2017-7-12
? How do you get from those minimizations in the paper to your u expression ??
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!