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

📄 landscape.m

📁 利用MATLAB作的分形地形源代码
💻 M
字号:
function landscape(n, factor, flag)

% landscape(N,FACTOR,FLAG) draws a fractal landscape 
% which is given by a recursively computed mountain in 3D -
% with or without randomisation.
% n gives the number of iterations; factor is the contraction factor;
% flag indicates whether the height difference is chosen randomly - 
% flag = 0 is random, every other flag gives the deterministic picture.
% 
% landscape(N,FACTOR) plots a random mountain (flag = 0).
%
% landscape uses n = 6 and factor = 0.4 in addition.

% default settings
if (nargin < 3)
    flag = 0;
end
if (nargin < 2)
    n = 6;
    factor = 0.4;
end

% loading the colormap
load mat2;
colormap (map);

% compute the co-ordinates of the mountain
[x1,x2,y] = landscape_matrix(n, factor, flag);

% plot the results
fill3(x1', x2', y', y'/max(max(y)));
axis off;
grid off;
camlight right;
view(-40,20);

⌨️ 快捷键说明

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