matlab源代码

源代码在线查看: seismic.m

软件大小: 464 K
上传用户: wuweixiong123
关键词: matlab 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				function rgb = seismic(n);
				
				% seismic(n) creates a colormap, ranging from dark blue via white to dark
				%red.
				%
				% Nico Sneeuw
				% Munich, 31/08/94
				
				if nargin == 0, n = size(get(gcf,'colormap'),1); end
				
				m    = ceil(n/3);
				top  = ones(m,1);
				bot  = zeros(m,1);
				up   = (0:m-1)'/m;
				down = flipud(up);
				
				r    = [bot; up; 1; top; down];
				g    = [bot; up; 1; down; bot];
				b    = [up; top; 1; down; bot];
				rgb  = [r g b];
				
				% rgb-map has size 4m+1 now. The central part will be extracted.
				
				xlarge = 4*m+1-n;
				xblue  = round(xlarge/2);
				xred   = xlarge - xblue;
				rgb([1:xblue 4*m-xred+2:4*m+1],:) = [];
							

相关资源