how to create functions to use with OPTIMIZATION toolbox

1 回表示 (過去 30 日間)
Dave Griffin
Dave Griffin 2017 年 7 月 21 日
回答済み: Star Strider 2017 年 7 月 21 日
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

回答 (2 件)

Alan Weiss
Alan Weiss 2017 年 7 月 21 日
I suggest that you read the Getting Started example.
Alan Weiss
MATLAB mathematical toolbox documentation

Star Strider
Star Strider 2017 年 7 月 21 日
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?

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by