function h = surfplot(f,xmin,xmax); % % h = surfplot(f,xmin,xmax) % % It plots the function f(x) of two variables, where f is % an inline object. % The first two components of vectors xmin and xmax % are used to define the fucntion. % % Example: % xmin = [0 0]; % xmax = [10 10]; % fstr = 'sin(x(1))*cos(x(2))'; % INSERT YOUR FUNC HERE % f = inline(fstr,'x'); % Comment lines above to make the function useful % Append any parameters to the function, if necessary. PTNUM = 30; x1 = linspace(xmin(1),xmax(1),PTNUM); x2 = linspace(xmin(2),xmax(2),PTNUM); for i=1:PTNUM, for j=1:PTNUM, Z(i,j) = f([x1(i),x2(j)]); % if ZZ(j,i)<-0.018, ZZ(j,i) = NaN; % it's an example how to delete points end; end; [X,Y] = meshgrid(x1,x2); h = mesh(X,Y,Z); return