How can I obtain the minimum slope with fmincon and a non-linear constraint?

1 view (last 30 days)
Hi guys,
I got a rather simple problem to help me understand fmincon better.. I have a linear function
--> Link1 : g= a1*x
The non linear constraint is:
function [ c, ceq ] = Easycon(a2,x)
c=-x^2+a2*x-14;
ceq=[];
end
where a2 = 6+a1 ( i tried to copy the example)
my fmincon is now:
x=fmincon(@(x) Link1(x,a1),[1],[],[],[],[],[],[],@(x) Easycon(x,a2),options)
options are already set.
I want to get like a1=1.4 more or less (which is the answer i'm looking for)
it doesnt give errors but the values are enormous.. Can anybody plz help me :)
thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!