Plotting fmincon with varying constraint
Show older comments
Hi all. I've got a function which I'm trying to minimize subject to a nonlinear constraint. I've been able to get this to work, but now I want to vary the constraint and plot the minimum as a function of this new parameter. I.e., I want to plot
subject to the constraint
The parameter a should take values in
. I can provide the files I'm working with upon request, but so far I've just been working with fmincon as provided in the documentation. Any advice is appreciated, thanks in advance!
subject to the constraint Accepted Answer
More Answers (1)
John D'Errico
on 30 Dec 2022
Edited: John D'Errico
on 30 Dec 2022
0 votes
You already know how to use fmincon. And surely you understand how to use a for loop.
- Set up a loop, varying a over the indicated domain.
- Call fmincon with the current value of a in the constraint, saving the results into a vector.
- After the loop has terminated, plot the results as a function of a.
Don't just provide the files, then asking us to write the complete code to solve your problem. Surely you can do exactly what I just explained in that basic algorithm. If then you have a problem, show what you tried. Explain where you are confused.
Categories
Find more on Function Creation 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!