Optimization problem with quadratic function

Hello everyone,
I hope someone could help me. This is the problem:
I have 12 points which are experimental measures, represented by 3 independent variables (x,y,z) and the fourth one that represents the density and it depends from the others: w= f(x,y,z). I need to:
-plot the data,
-obtain the quadratic fit function w, i.e. the function that describes the density,
-represent the isosurfaces where w is constant.
- Finally I need to minimize this quadratic function with no constraints.
Starting from
x = rand(12, 1);
y = rand(12, 1);
z = rand(12, 1);
w = rand(12, 1);
I found the quadratic function but I'm not sure how to represent the values of f(x,y,z) like isosurfaces and how to minimize it.
Thanks a lot!
Laura

 Accepted Answer

You can use isosurface() to plot and quadprog() to minimize.

4 Comments

Thank you very much for your prompt reply!
I wrote the optimization problem like this:
p.Objective =p = optimproblem
p.Description = "minimization"
x = optimvar("x", "LowerBound", -1, "UpperBound",1);
y = optimvar("y", "LowerBound", -1, "UpperBound",1);
z = optimvar("z","LowerBound", -1, "UpperBound",1 );
p.Objective = -3.4614 +4.2699*z + -1.9757*y + 5.8535*x -2.0954*z.^2 -3.7708*y.^2 + -1.2299*x.^2 - 3.1261*y.*z - 0.9395*x.*z - 3.1720*x.*y
initialPt.x = 1;
initialPt.y = 1;
initialPt.z = 1;
hold on
[sol,fval,exitflag,outout] = solve(p,initialPt)
hold off + 2.8392*z + 0.5153*y + 0.7036*x -2.2113*z.^2 -0.1385*y.^2 + 0.3061*x.^2 - 0.5117*y.*z - 1.3679*x.*z - 0.0074*x.*y
It uses the quadprog solver.
Do you think that it could be correct?
I'm not sure how to use isosurface() to plot it.
Thank you
Matt J
Matt J on 10 Jun 2021
Edited: Matt J on 10 Jun 2021
It looks like you might have a few copy/paste errors in your post, but otherwise, yes, it looks correct. Also, since it is a non-convex quadratic, it might be a good idea to try multiple initialPts.
Thanks a lot for your help and support!!
That was helpful!
Kind Regards,
Laura
I'm glad, but please Accept-click the answer if the your question is now resolved.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 10 Jun 2021

Commented:

on 11 Jun 2021

Community Treasure Hunt

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

Start Hunting!