Fonction fmincon
asil
-
Krys_06 Messages postés 22 Date d'inscription Statut Membre Dernière intervention -
Krys_06 Messages postés 22 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
mon travail est comme suit:fonction objective:
function J = myfunobj(v)
a=0;
b=1;
mu=1;
v=(1:10)';
n=length(v);
h=(b-a)/(n+1);
x1=2*ones(n,1);
x2=ones(n-1,1);
Ah=1/h*(diag(x1,0)-diag(x2,1)-diag(x2,-1));
y1=2*v.*v;
y2=1/2*(v(1:n-1).*v(2:n)+v(1:n-1).^2 +v(2:n).^2);
Mh=h/5*(diag(y1,0)+diag(y2,1)+diag(y2,-1));
J=1/2*dot(Ah*v,v)+mu*1/4*dot(Mh*v,v);
end
fonction containte non lineaire
function[Ceq,C]=myfuncon(v)
a=0;
b=1;
v=(1:10)';
n=length(v);
h=(b-a)/(n+1);
z1=ones(n,1);
z2=ones(n-1,1);
Bh=h/6*(4*diag(z1)+diag(z2,1)+diag(z2,-1));
Ceq =dot(Bh*v,v)-1;
C=[];
end
fonction fmincon est:
%chercher le minimum de J avec contrainte d'égalité
J=myfunobj(v);
[Ceq,C]=myfuncon(v);
[u]= fmincon(@myfunobj,v0,[],[],[],[],[],[],@myfuncon,option);
le resultat est comme ça quand je fais la compilation:
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point or sqp algorithms:
set the Algorithm option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
In myfun at 4
No feasible solution found.
fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance but constraints are not
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
je ne sais pas ou la faute et qu'est ce je fais .
Et merci
mon travail est comme suit:fonction objective:
function J = myfunobj(v)
a=0;
b=1;
mu=1;
v=(1:10)';
n=length(v);
h=(b-a)/(n+1);
x1=2*ones(n,1);
x2=ones(n-1,1);
Ah=1/h*(diag(x1,0)-diag(x2,1)-diag(x2,-1));
y1=2*v.*v;
y2=1/2*(v(1:n-1).*v(2:n)+v(1:n-1).^2 +v(2:n).^2);
Mh=h/5*(diag(y1,0)+diag(y2,1)+diag(y2,-1));
J=1/2*dot(Ah*v,v)+mu*1/4*dot(Mh*v,v);
end
fonction containte non lineaire
function[Ceq,C]=myfuncon(v)
a=0;
b=1;
v=(1:10)';
n=length(v);
h=(b-a)/(n+1);
z1=ones(n,1);
z2=ones(n-1,1);
Bh=h/6*(4*diag(z1)+diag(z2,1)+diag(z2,-1));
Ceq =dot(Bh*v,v)-1;
C=[];
end
fonction fmincon est:
%chercher le minimum de J avec contrainte d'égalité
J=myfunobj(v);
[Ceq,C]=myfuncon(v);
[u]= fmincon(@myfunobj,v0,[],[],[],[],[],[],@myfuncon,option);
le resultat est comme ça quand je fais la compilation:
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point or sqp algorithms:
set the Algorithm option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
In myfun at 4
No feasible solution found.
fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance but constraints are not
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
je ne sais pas ou la faute et qu'est ce je fais .
Et merci
A voir également:
- Fonction fmincon
- Fonction si et - Guide
- Fonction miroir - Guide
- Fonction moyenne excel - Guide
- Fonction remplacer sur word - Guide
- Fonction somme excel - Guide