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 CenterFile Exchange에서 Solver 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