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

📄 rainbow.m

📁 精通Matlab综合辅导与指南 用于数学建模的教科书
💻 M
字号:
function map=rainbow(m)%RAINBOW Colormap Variant to HSV.% RAINBOW(M) Rainbow Colormap with M entries.%% Red - Orange - Yellow - Green - Blue - Violet%% RAINBOW by itself is the same length as the current colormap.%% Apply using: colormap(rainbow)% D. Hanselman, University of Maine, Orono, ME  04469% 3/23/95% Copyright (c) 1996 by Prentice Hall, Inc.if nargin<1, m=size(get(gcf,'colormap'),1); endmp=[ 1   0  0  % red 1  1/3 0  % orange 1   1  0  % yellow 0   1  0  % green 0   0  1  % blue.5   0 .5];% violetif m<=6,map=mp(1:m,:);return,endk=ceil(m/5);mk=5*k+1;map=zeros(mk,3);ks=(0:4)*k +1;for i=0:k-1	a=(1+cos(pi*i/k))/2;b=1-a;	% cosine interp to maximize rainbow colors	map(i+ks,:)=a*mp(1:5,:) + b*mp(2:6,:);endmap(mk,:)=mp(6,:);map=map(1:m,:);

⌨️ 快捷键说明

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