Plot 3D of coinstraned optimization
Mostrar comentarios más antiguos
Good evening, for my thesis I should make a 3d plot in which I want something similar to this:

I have a function f(x,y)=x^2-2*x+1+y^2 subject to constraints g(x,y)=x^4+y^4-1.
I'm interested only in the plot.
Respuesta aceptada
Más respuestas (1)
Torsten
el 11 de Abr. de 2022
x=-2:0.01:2;
y=-2:0.01:2;
[X,Y] = meshgrid(x,y);
Z = X.^2-2*X+1+Y.^2;
xx=-1:0.01:1;
yy=-1:0.01:1;
y1 = (1-xx.^4).^(0.25);
y2 = -(1-xx.^4).^(0.25);
z1 = xx.^2-2*xx+1+y1.^2;
z2 = xx.^2-2*xx+1+y2.^2;
surf(X,Y,Z)
hold on
plot3(xx,y1,z1,'Linewidth',4,'Color','red')
hold on
plot3(xx,y2,z2,'Linewidth',4,'Color','red')
view([2,2,4])
1 comentario
Michele Guaragno
el 12 de Abr. de 2022
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
