Effacer les filtres
Effacer les filtres

convert math expression to matlab code

6 vues (au cours des 30 derniers jours)
Bourne Zhang
Bourne Zhang le 20 Mai 2023
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 commentaire
John D'Errico
John D'Errico le 20 Mai 2023
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.

Connectez-vous pour commenter.

Réponses (1)

Dongyue
Dongyue le 23 Mai 2023
You can try MATLAB Optimization Toolbox
Please go through the following link for more information:

Community Treasure Hunt

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

Start Hunting!

Translated by