# Help in defining fmincon fucntion - Optimization Toolbox

조회 수: 1(최근 30일)
Afz 2012년 8월 28일
I am unfamiliar with working of MATALAB so I need some basic help in using this function.
I want to make my function zero or near zero (It could be negative value but it should be a value nearest to zero)
The other constrains is the all variables should be in between 0.3 to 0.7. Its values can have up to 10 digits after decimal points e.g 0.54465941365)
Problem Its not giving me a value that could give a near zero value.
Thankyou
Here is my Problem Setup
Objective function: @myfun
Derivatives: Approximated by Solver
Start point:[0;0;0;0;0]
A: Empty b: Empty
Aeq: Empty beq:Empty
Bounds:
Lower: [0.3;0.3;0.3;0.3;0.3]
Upper: [0.7;0.7;0.7;0.7;0.7]
Nonlinear constraint function: Empty
Derivatives: Approximated by solver
Options: Default
Results
Objective function value: -390.45426224401234
Local minimum found that satisfies the constraints.
Final Points
Variable 1.0 = 0.6
Variable 2.0 = 0.3
Variable 3.0 = 0.6
Variable 4.0 = 0.3
Variable 5.0 = 0.6

댓글을 달려면 로그인하십시오.

### 답변(2개)

Walter Roberson 2012년 8월 28일
fmincon is a minimizer, not a 0 finder.
You could minimize @(x) myfun(x).^2
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

Alan Weiss 2012년 8월 28일
Alan Weiss
MATLAB mathematical toolbox documentation

댓글을 달려면 로그인하십시오.

### 범주

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!