Could anyone help to draw the 3D graph for below equation?

1 view (last 30 days)
Could anyone help to draw the 3D graph for below equation? My equation is as follow but not working.
[My equation] f(x1, x2) = 1000 + 7 * x1 - 700 * x2 + 23 * x1 * x2 + 10 * x1^2 + 5.6 * x2^2
[Matlab]
[X,Y] = meshgrid(-30:10:50);
Z = 1000 + 7*X. - 700*Y. + 23*X.*Y. + 10*X.^2 + 5.6 * Y.^2;
Thank you.

Accepted Answer

Star Strider
Star Strider on 8 Feb 2015
There were some problems with the way you wrote your equation for ‘Z’. This works:
[X,Y] = meshgrid(-30:10:50);
Z = 1000 + 7*X - 700*Y + 23*X.*Y + 10*X.^2 + 5.6 * Y.^2;
figure(1)
surfc(X, Y, Z)
grid on

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!