# how can i code in matlab to find the optimal parameter of function

10 views (last 30 days)
prakash kumar on 15 Apr 2015
Answered: Nicholas Ayres on 27 Oct 2020
There is a function Q(t)= a1*A(t)+ a2*B(t)+ a3*A(t)^2*B(t)+ a4*A(t)*B(t) ^2+a5* B(t) ^3+ a6 A(t) ^3+ a7*A(t) ^2*C(t) Where P(t), A(t), B(t) and C(t) are known for any point of time or a sample of time. Then I want to obtain the value of a1, a2, a3,a4,a5,a6,a7 with constrained a1>0, a2<0, a3>0,a4>0, a6>0, a5 and a7 unbounded So that P(t)-Q(t) become minimum or negligible at any point of time.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Answers (2)

Alan Weiss on 16 Apr 2015
If you have Optimization Toolbox, this looks like a job for fmincon.
Alan Weiss
MATLAB mathematical toolbox documentation
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Nicholas Ayres on 27 Oct 2020
For anybody stumbling across this, there is the "fminsearch" function, which could be used to do this.
This function is within the default MatLab package.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on Problem-Based Optimization Setup 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!