📄 rainbow.m
字号:
function rainbow()%RAINBOW Draw a rainbow in a Matlab figure.% This function is an example to show how one can use the PCOLOR% function to obtain a plot that looks like a rainbow.% Jordan Rosenthal, 17-May-2000% jr@ece.gatech.eduN = 64;r = linspace(0.7,1,N); %从0.7到1均匀取64个点生成一个线性矩阵th = linspace(pi/3,2*pi/3,N); %从pi/3到2pi/3均匀取64个点生成一个线性矩阵[R,TH] = meshgrid(r,th); %生成一个64*64的方阵[X,Y] = pol2cart(TH,R); %将TH,R作为极坐标上对应于角度和半径的值 。 % 并将之转化为直角坐标x,ypcolor(X,Y,reshape(1:N^2,N,N)); %在x,y定义的点上填充颜色。颜色的渐变由后面的矩阵来定义。shading interp; %平滑axis equal off; %去掉坐标
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -