Home > database >  fmincon error occurs without details in Matlab
fmincon error occurs without details in Matlab

Time:11-12

I followed the instructions, but what I only can get is "error in (filename)" without any additional details. Could you tell me which part made an error?

clear;clc;lb = [0,0]; 
ub = [1,1]; 
A = [1 1]; 
B = [1]; 
Aeq = []; 
Beq = []; 
x0=[0.5, 0.5]; 
f=@(x)(200*x(1)-37)^2 (200*x(2)-83)^2 (200*x(1) 200*x(2)-122)^2 (400*x(1)-82)^2 (400*x(2)-157)^2 (400*x(1) 400*x(2)-250)^2; 
x = fmincon(f,x0,A,B,Aeq,Beq,lb,ub)

CodePudding user response:

this code is work fine, and this is the result: x =

    0.2090    0.4050

you needs to save your script file and add the folder contain your file to matlab "Add to path".

enter image description here

  • Related