资源简介
matlab开发-spy2m。有了这个,你可以更容易地确定矩阵的元素位置。
![](http://www.nz998.com/pic/70732.jpg)
代码片段和文件信息
function spy2(Acol)
%SPY2 An improvement of SPY
% SPY2(A) where A is a matrix will plot
% the matrix with color codes.
% Elements containing NaN or Inf will be counted as
% non-zero but will be displayed
% as zero elements.
%
% SPY2(ACOLOR) will plot zero elements with
% white color and nonzero elements with black
% color.
% Elements containing NaN or Inf will be counted as
% non-zero and will also be displayed
% as non-zero elements.
%
% The displayed matrix will have sides proportional to
% the number of elements in each row/column.
% If the matrix contains complex numbers only the real
% part will be displayed.
%
% See also SPY.
% Copyright 2000-11-14 B. Rasmus Anthin.
% Revision 2003-09-15 2003-09-16.
error(nargchk(12nargin))
A=real(double(A));
A(~isfinite(A))=realmin;
A(end+1end+1)=0;
x=1:size(A2);
y=1:size(A1);
[XY]=meshgrid(x-.5y-.5); %i use surf and meshgrid instead of pcolor so that
if nargin==1
surf(XYA) % the element numbers will be correctly aligned
colormap gray %just change this afterwards to get another colormap
colorbar
else
A=~~A;
A(1:endend)=0;
A(end1:end)=0;
surf(XYA)
if ischar(col)
switch(lower(col))
case {‘y‘‘yellow‘}
col=[1 1 0];
case {‘m‘‘magenta‘}
col=[1 0 1];
case {‘c‘‘cyan‘}
col=[0 1 1];
case {‘r‘‘red‘}
col=[1 0 0];
case {‘g‘‘green‘}
col=[0 1 0];
case {‘b‘‘blue‘}
col=[0 0 1];
case {‘w‘‘white‘} %very bad idea :-)
col=[1 1 1];
case {‘k‘‘black‘}
col=[0 0 0];
otherwise
col=[0 0 1]; %default to blue color
end
end
if isempty(col) col=[0 0 1];end
colormap([1 1 1;col])
end
view(2)
axis ij equal tight
box on
xlabel([‘nz = ‘ int2str(nnz(A))])
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1946 2018-07-11 20:21 spy2.m
相关资源
- matlab开发-能带计算
- matlab开发-FlockingAlgorithm
- matlab开发-MuellerStokesJonesCalculus
- matlab开发-HX711的自定义数据库
- matlab开发-SMOTEBoost
- matlab开发-果蝇优化算法第二版
- matlab开发-多变量决策树
- matlab开发-水轮发电机模型
- matlab开发-交通警告标志识别标签代码
- matlab开发-RUSBoost
- matlab开发-基于遗传算法的机器人运动
- matlab开发-MPU6050加速度陀螺仪
- matlab开发-功率曲线FAsmallscalewindturbi
- matlab开发-NASAJPLDE405开发星历表
- matlab开发-SortinoRatio
- matlab开发-永磁TDC并联电机数学模型
- matlab开发-3相SPWM整流器
- matlab开发-Kilobotswarm控制Matlabarduino
- matlab开发-简单音频播放
- matlab开发-记录文件的绘图仪加速度、
- matlab开发-永磁同步电机PMSM动态数学模
- matlab开发-多目标优化差分进化算法
- matlab开发-随机微分方程解算
- matlab开发-波长调制光谱的二次谐波模
- matlab开发-仿制药生物生理学基础药动
- matlab开发-使用svmrfe选择功能
- matlab开发-KDTreeNearestNeighborandRangeSear
- matlab开发-stlread
- matlab开发-三维图像堆栈查看器
- matlab开发-动态电压恢复器故障dvr
评论
共有 条评论