diff options
author | Harpreet | 2016-08-04 15:25:44 +0530 |
---|---|---|
committer | Harpreet | 2016-08-04 15:25:44 +0530 |
commit | 9fd2976931c088dc523974afb901e96bad20f73c (patch) | |
tree | 22502de6e6988d5cd595290d11266f8432ad825b /exam.sce | |
download | FOSSEE-Optim-toolbox-development-9fd2976931c088dc523974afb901e96bad20f73c.tar.gz FOSSEE-Optim-toolbox-development-9fd2976931c088dc523974afb901e96bad20f73c.tar.bz2 FOSSEE-Optim-toolbox-development-9fd2976931c088dc523974afb901e96bad20f73c.zip |
initial add
Diffstat (limited to 'exam.sce')
-rw-r--r-- | exam.sce | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/exam.sce b/exam.sce new file mode 100644 index 0000000..819d8d6 --- /dev/null +++ b/exam.sce @@ -0,0 +1,27 @@ +function y = fun(x) + y = 3*x(1)^2 + 2*x(1)*x(2) + x(2)^2 - 4*x(1) + 5*x(2) ; +endfunction + +[xval, fval, status, gradient, hessian] = intfminunc(fun,[1 2],[2]) + +x1 = [0,-5]; +x2 = [4,4]; + +[xval, fval, status, gradient, hessian] = intfminbnd(fun,[1],x1,x2) + + //Find x in R^6 such that it minimizes: + //f(x)= sin(x1) + sin(x2) + sin(x3) + sin(x4) + sin(x5) + sin(x6) + //-2 <= x1,x2,x3,x4,x5,x6 <= 2 + //Objective function to be minimised + function y=f(x) + y=0 + for i =1:6 + y=y+sin(x(i)); + end + endfunction + //Variable bounds + x1 = [-2, -2, -2, -2, -2, -2]; + x2 = [2, 2, 2, 2, 2, 2]; + intcon = []; + //Options + [x,fval] =intfminbnd(f ,intcon, x1, x2) |