MATLAB: How to plot below function of two variables

hemant

Best Answer

x = 0 : 0.02 : 2; % 2 is not equal to infinity, but it shows the behavior.
y = 0 : 0.02 : 2;
[xx,yy] = meshgrid(x,y);
f = 3.*(xx<=1 & yy<=1) + exp(xx+yy).*(xx>1 & yy>1);
figure
h = mesh(xx,yy,f);