ex10_1.m

来自「Advanced Engineering Mathematics using M」· M 代码 · 共 24 行

M
24
字号
% EX10_1.M Plot a contour map and surface of the function%  z=x^2y+x^2+2y^2clear                   % Clear variable and figuresclf x=[-2.0:.15:2.0];       % Define x,y pointsy=[-2.0:0.15:2.0];v=[0.5 1 2];		% Define level values[X,Y]=meshgrid(x,y);    % Create matrix of pointsZ=Y.*(X.^2)+X.^2+2*(Y.^2);c=contour(x,y,Z,v);clabel(c)               % Add height values to contourstitle('Contour Plot of z=x^2y+x^2+2y^2')pause% Plot a surface and meshfigure                  % Create a new figure windowsubplot(2,1,1),surf(X,Y,Z)xlabel('x')ylabel('y')subplot(2,1,2),plot3(X,Y,Z)title('Surface and Mesh Plots')xlabel('x')ylabel('y')%% Strike a key to see second plot after the pause

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?