MATLAB Answers

how can i write cost function in firefly algorithm for optimal tuning pid parameters in matlab

14 views (last 30 days)
sandy jeak
sandy jeak on 15 Apr 2017
Edited: Walter Roberson on 6 Sep 2017
Iam using firefly algorithm for optimal tuning pid parameters , the cost function is IAE i wrote IAE function as a function of pid parameters {kp,ki.kd} but it doesnot work it gives error that it undefined variable ,should i give initial values for parameters?? and what is error in the IAE function
costFunction = integral(abs(error),0,Inf);
it gives Undefined function 'abs'

Answers (2)

noor diyana
noor diyana on 11 May 2017
Here are example from my senior project. You can try it. You can change the objective function, MaxIt, runtime as system that you want. Anything can email me diyana.escosa2014@gmail.com All the best!
  1 Comment
sandy jeak
sandy jeak on 13 May 2017
Thanks for answering me, I put my system in the code and i have that error Reference to non-existent field 'Position'. Error in main (line 112) Trace_pid=[Trace_pid;BestSol.Position]; How can I fix that. Thanks in advance

Sign in to comment.


ednilson szeskoski
ednilson szeskoski on 3 Sep 2017
I have the same problem. I'm implementing PID for a voltage control system. The goal is to optimize using firefly, the same error quoted is happening, how can I implement in the code the transfer function of my case? Thank you.
tf([0.004, 0.454, 5.55, 15.1, 10], [1.6e-05, 0.002032, 0.04732, 0.4286, 2.133, 8.76, 18.01, 11])
  3 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!