how to create functions to use with OPTIMIZATION toolbox

1 view (last 30 days)
Hi I have a function f(x)
f(x)=(-5.1053e-24)*x.^10+ 3.1554e-20*x.^9 ...
+(-8.007e-17)*x.^8 + (1.0766e-13)*x.^7 + (-8.3199e-11)*x.^6 ...
+ 3.8516e-08*x.^5 ...
+ (-1.1699e-05)*x.^4 + 0.0028143*x.^3 ...
+ -0.50301*x.^2 + 46.148*x + 1228.1
I am trying to set this up in a matter that I can create a valley filling solution to this function, What is the best way to create a function file for f(x) to fulfill the valley filling scenario using the OPTIMIZATION toolbox,
x is an array from 1 to 96 in steps of 1

Answers (2)

Alan Weiss
Alan Weiss on 21 Jul 2017
I suggest that you read the Getting Started example.
Alan Weiss
MATLAB mathematical toolbox documentation

Star Strider
Star Strider on 21 Jul 2017
The Optimization Toolbox functions (except for lsqcurvefit) require a function with an input argument that is a vector of parameters to optimize. In your function, ‘x’ would be treated as a single parameter, and the functions would then find the one value that minimized it or equated it to zero (depending on the optimization function you call with it).
The correct syntax would be:
f = @(x) (-5.1053e-24)*x.^10+ 3.1554e-20*x.^9 ...
Please explain what you intend by ‘valley filling solution’.
What do you want to do?

Categories

Find more on Parallel Computing 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!