mm2805.m
来自「matlab7.0这本书的源代码」· M 代码 · 共 31 行
M
31 行
x = -7.5:.5:7.5; % data[X Y] = meshgrid(x); % create plaid dataR = sqrt(X.^2 + Y.^2)+eps; % create sombreroZ = sin(R)./R;
subplot(2,2,1)
surf(X,Y,Z,abs(del2(Z))) % absolute Laplacian
colormap(gray)
shading interp
axis tight off
title('Figure 28.5a: |Curvature|')
subplot(2,2,2)
[dZdx,dZdy] = gradient(Z); % compute gradient of surfacesurf(X,Y,Z,abs(dZdx)) % color varies with absolute slope in x-directionshading interp
axis tight off
title('Figure 28.5b: |dZ/dx|')
subplot(2,2,3)
surf(X,Y,Z,abs(dZdy)) % color varies with absolute slope in y-directionshading interp
axis tight off
title('Figure 28.5c: |dZ/dy|')
subplot(2,2,4)
dR = sqrt(dZdx.^2 + dZdy.^2);
surf(X,Y,Z,abs(dR)) % color varies with absolute slope in radiusshading interp
axis tight off
title('Figure 28.5d: |dR|')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?