MATLAB Answers

Optimization problem - solving problem within a loop

4 views (last 30 days)
Muzammil Ali
Muzammil Ali on 9 Jul 2019
Commented: Muzammil Ali on 29 Jul 2019
I have a function in which I am using a loop and also discretisation in time. It is solving a PDE using Fully implicit backward method. I want to know how to define the objective function as the values are changing within the loop with time. Also how do I specify the variables which need to be modified for optimisation.
Thank you.


Sign in to comment.

Answers (1)

Yogesh Khurana
Yogesh Khurana on 29 Jul 2019
You can use Optimization Expressions for defining objective functions and its variables inside a for-loop. Refer to the following link for more information:
Hope it helps!

  1 Comment

Muzammil Ali
Muzammil Ali on 29 Jul 2019
I have two variables to optimise and I put it in the following form:
ratio = optimvar('ratio',1,1,'LowerBound',0,'UpperBound',1);
Dsw = optimvar('Dsw',1,1,'LowerBound',0,'UpperBound',1e-9);
But I get the following error:
Undefined function 'exp' for input arguments of type 'optim.problemdef.OptimizationExpression'.
Error in drying_optimisation_function (line 409)

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!