convert math expression to matlab code
8 次查看(过去 30 天)
显示 更早的评论
Hello Experts and community members,
I am sorry but I am new to Matlab, and would like to know How can I conver the following math expression to matlab code?
and I am lerning the paper of WOA, whale optimization algorithm, so if I would like to add the above to the function, anything I need to pay attention to?
Thank you so much in advance for any input and insights!
1 个评论
John D'Errico
2023-5-20
If you are new to MATLAB, then if someone gives you highly optimized code to do this will be useless. You won't understand it, and it would take a couple of pages of explanation to get you to understand what it does, and you still won't be able to write a similar function yourself the next time. Yes, the objective is a quadratic functional of the vector w, with linear constraints. So you should be able to write this as a call to quadprog. But it sounds as if you are asking how to write this for your own optimizer.
Instead, just learn to write the objective using LOOPS. Loops are simple. And the call to optimize it, if you were using a tool like fmincon will be simple, but any other tool that allows a linear equality constraint and bound constraints would suffice.
回答(1 个)
Dongyue
2023-5-23
You can try MATLAB Optimization Toolbox
Please go through the following link for more information:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!