⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demosurftypes.m

📁 这是《Numerical Methods with MATLAB: Implementation and Application》一书的配书程序(Matlab)
💻 M
字号:
function demoSurfTypes(n)
% demoSurfTypes Different types of surface plots for z = 2 - x^2 - y^2
%
% Synopsis:  demoSurfTypes(n)
%
% Input:     n = (optional) number of grid lines in x and y directions
%                Default: n = 10
%
% Output:    Surface plot

if nargin<1,  n=10;  end

x = linspace(-5,5,n);
[XG,YG] = meshgrid(x,x);
Z = 2 - (XG.^2 + YG.^2);

subplot(2,2,1)
mesh(x,x,Z);     title('mesh plot');

subplot(2,2,2)
surf(x,x,Z);     title('surf plot');

subplot(2,2,3)
surfc(x,x,Z);    title('surfc plot');

subplot(2,2,4)
surfl(x,x,Z);    title('surfl plot');

colormap('gray');

⌨️ 快捷键说明

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