5.2 Plot the surface described by 2D function

Problem: Plot the function \[ f(x,y)=x^{2}-2xy+3y+2 \]

Mathematica

Remove["Global`*"]; 
f[x_,y_]:=x^2-2x y+3y+2; 
Plot3D[f[x,y],{x,-4,4},{y,-3,3}, 
    PlotLabel->"Plot of x^2-2x y+3y+2", 
    ImageSize->300]
 

pict

 

Matlab

clear all; close all; 
x = -4:.3:4; 
y = -3:.3:3; 
[X,Y] = meshgrid(x,y); 
Z = X.^2 - 2*(X.*Y) + 3*Y + 2; 
surf(X,Y,Z) 
title('plot of z=x^2-2(x y)+3y+2'); 
set(gcf,'Position',[10,10,420,420]);
 

pict