There is no added value when using NDcost, you can directly use numderivative like this

function [f,g,ind]=costf(p,ind)
    f=norm(fun(p))^2;
    g=2*numderivative(fun,p)'*fun(p);
endfunction

S.

Le 08/01/2020 à 16:45, David Brant a écrit :
Many thanks Stéphane.

Is it also possible to do this if the gradient is not known or impractical
to obtain using NDcost as i had intended with something like

[fopt,popt,gopt]=optim(list(NDcost,fun),p0') ?

Regards, Dave



--
Sent from: 
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to