call fmincon from vc6.0 where the objf and constraints vary from arguments
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
I use mcc to compiler fmincon to
myfmincon(int nargout, mwArray& x, mwArray& fval, mwArray& exitflag, const mwArray& myfun, const mwArray& xx0, const mwArray& A, const mwArray& B, const mwArray& Aeq, const mwArray& Beq, const mwArray& LB, const mwArray& UB, const mwArray& mycon);
Now i have myfun and mycon defined in vc6.0 and they have different expressions varying from the input,someone like following:
double myfun(double x[])
{
double f = 0;
int N = 100;
for(int i=0; i < N; i++)
f = f+x[i]*x[N-i];
return f;
}
double mycon(double x[], double y[])
{
...
return...
}
So, how i can use fmincon in this situation, someone have any ideas? Thanks very much!
Edit [30 Jul 2012, 14:24 BST - OK] Embedded info from answer
in the function fmincon, myfun and mycon are function handles, so how can i define variables in c++ to pass to fmincon(dll)?
2 Commenti
Oleg Komarov
il 30 Lug 2012
For reference on how to properly format your question, especially the code: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
lin he
il 30 Lug 2012
Risposte (0)
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!