?? rainbow.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 + -