MATLAB: How to plot these function plesa help

3dfunctionplot functiontwo variables

Hello.
I tried almost everything, but with no succsess. Maybe anyone knows and can share matlab code to plot these function: f(x) = (4 – 2.1*x1^2 + x1^4/3)*x1^2 + x1*x2 + (-4 + 4*x2^2)*x2^2
Thank you

Best Answer

Joe, you could use
[x1,x2] = meshgrid(0:0.5:10,0:0.5:10);
f = (4 - 2.1*x1.^2 + x1.^4/3).*x1.^2 + x1.*x2 + (-4 + 4*x2.^2).*x2.^2;
surf(x1,x2,f)