以下是printmat的略微修改版本,可以打印复数。随意摆弄一下以获得更好的外观:)

function [] = printmat2(a,name,rlab,clab)

%PRINTMAT Print matrix with labels.

% PRINTMAT(A,NAME,RLAB,CLAB) prints the matrix A with the row labels

% RLAB and column labels CLAB. NAME is a string used to name the

% matrix. RLAB and CLAB are string variables that contain the row

% and column labels delimited by spaces. For example, the string

%

% RLAB = 'alpha beta gamma';

%

% defines 'alpha' as the label for the first row, 'beta' for the

% second row and 'gamma' for the third row. RLAB and CLAB must

% contain the same number of space delimited labels as there are

% rows and columns respectively.

%

% PRINTMAT(A,NAME) prints the matrix A with numerical row and column

% labels. PRINTMAT(A) prints the matrix A without a name.

%

% See also: PRINTSYS.

% Clay M. Thompson 9-24-90

% Copyright 1986-2002 The MathWorks, Inc.

% $Revision: 1.10 $ $Date: 2002/04/10 06:32:35 $

error(nargchk(1,4,nargin));

space = ' ';

[nrows,ncols] = size(a);

if nargin<2, name = []; end

if nargin==3, error('Wrong number of input arguments.'); end

if nargin<4,

rlab = []; clab = [];

for i=1:nrows, rlab = [rlab, sprintf('--%d--> ',i)]; end

for i=1:ncols, clab = [clab, sprintf('--%d--> ',i)]; end

rlab=rlab(1:length(rlab)-1);

clab=clab(1:length(clab)-1);

end

col_per_scrn=5;

len=12;

if (nrows==0)|(ncols==0),

if ~isempty(name), disp(' '), disp(sprintf('%s = ',name)), end

disp(' ')

disp(' []')

disp(' ')

return

end

% Remove extra spaces (delimiters)

ndx1 = find(clab==' ');

ndx2 = find([ndx1,0]==[-1,ndx1+1]);

if ~isempty(clab), clab(ndx1(ndx2))=[]; end

ndx1 = find(rlab==' ');

ndx2 = find([ndx1,0]==[-1,ndx1+1]);

if ~isempty(rlab), rlab(ndx1(ndx2))=[]; end

% Determine position of delimiters

cpos = find(clab==' ');

if length(cpos)

cpos = [0,cpos,length(clab)+1];

rpos = find(rlab==' ');

if length(rpos)

rpos = [0,rpos,length(rlab)+1];

col=1;

n = min(col_per_scrn-1,ncols-1);

disp(' ')

if ~isempty(name), disp(sprintf('%s = ',name)), end % Print name

while col<=ncols

% Print labels

s = space(ones(1,len+1));

for j=0:n,

lab = clab(cpos(col+j)+1:cpos(col+j+1)-1);

if length(lab)>len,

lab=lab(1:len);

else

lab=[space(ones(1,len-length(lab))),lab]; end

s= [s,' ',lab];

end

disp(setstr(s))

for i=1:nrows,

s = rlab(rpos(i)+1:rpos(i+1)-1);

if length(s)>len, s=s(1:len); else s=[space(ones(1,len-length(s))),s]; end

s = [' ',s];

for j=0:n,

element = a(i,col+j);

if imag(element) ~= 0

s=[s,sprintf('%12.5f + %12.5fi',[real(element) imag(element)])];

else

if element==0,

s=[s,' 0'];

elseif (element>=1.e6)|(element<=-1.e5)|(abs(element)<.0001>

s=[s,sprintf(' %12.5e',element)];

else

s=[s,sprintf(' %12.5f',element)];

end

end

end

disp(s)

end % for

col = col+col_per_scrn;

disp(' ')

if (ncols-col

end % while

% end printmat

matlab具有复数,MATLAB:具有复数的printmat相关推荐

  1. matlab 虚数 .,关于MATLAB在复数方面的应用 – MATLAB中文论坛

    最近,看到有不少朋友问MATLAB在复数方面的应用问题,特此发个帖子,给大家分享点资料. matlab在复数中的应用 1.复数的生成 复数生成语句(其中theta为复数辐角的弧度值,r为复数的模) z ...

  2. matlab中如何对一组复数频域信号进行快速傅里叶逆变换

    matlab中如何对一组复数频域信号进行快速傅里叶逆变换 为何需要对复数频域信号进行快速傅里叶逆变换 快速傅里叶变换(fft)后的数据格式 快速傅里叶逆变换至原信号时域波型 第一步 第二步 第三步 验 ...

  3. MATLAB笔记之复数以及基本复数函数二维视角(2d)图形绘制

    MATLAB笔记之复数以及基本复数函数二维视角(2d)图形绘制 QQ:3020889729 小蔡 一般复数的2d图形绘制 一般复数的平移图形~(即一个复数加另一个复数实现在复平面的平移) 补充几个复数 ...

  4. matlab中如何处理复数,matlab中复数的处理函数

    matlab中复数的处理函数 MATLAB 中复数的处理函数要说明复数的运算,先从解以下的二次方程式的复数根谈起上式的根有实部 (-2) 及虚部 (±3),我们就这个复数的表示法来说明 MATLAB的 ...

  5. MATLAB导入文本中的复数

    MATLAB导入文本中的复数 试了很多方法,下面代码亲测可用, F_d为文件名,里面为一列复数. fileID = fopen('F_d.txt'); C = textscan(fileID,'%f' ...

  6. matlab复数的相位,复数的幅值和相位

    [i]); x[i]=x[i]*180/PI-90; printf("第%d次谐波的相位为为%f \\n", i , x[i]) ; } printf("第%d次谐波的幅 ...

  7. 【MATLAB HDF5】Matlab将复数保存到hdf5文件

    Matlab 对于hdf5文件的操作函数分为高级函数和低级函数,高级函数包括h5create.h5read.h5write.h5disp等.在我想使用h5create保存复数数据时,我发现,数据类型参 ...

  8. matlab 数学库,matlab数学函数库

    (n) 求 n 的阶乘 如何用 matlab 配方 没有发现 matlab 有这一命令,不过我们可以调用 maple 的命令,调用方法如下: 首先加载 maple 中的 student 函数库,加载. ...

  9. matlab错误原因,matlab常见错误分析

    这里是几个Matlab的小提示,基本上是我使用Matlab时碰到并解决了的问题,希望能使别人不要再碰钉子走弯路了.如果有建议或发现其中有错误,请与我联系. 循环变量 由于历史的原因,程序员们总是使用i ...

  10. matlab函数exp,Matlab基本函数-exp函数

    1.exp函数:求以e为底的指数函数 2.用法说明:y=exp(x) 函数对数组元素x进行逐个处理的函数.函数定义域包括复数.对于复数z=a+b*i,有ez=(cos(b)+i*sin(b)*ea) ...

最新文章

  1. js php 正则差别,正则表达式(括号)、[中括号]、{大括号}的区别小结,正则表达式小结...
  2. UITabBarController+UINavigationController+UIToolBar
  3. 开发和使用Web用户控件
  4. Linux不停往外发包
  5. 计算机电路逻辑分析基础知识答案,计算机电路基础学习指导与习题解答
  6. string类的用法详解
  7. 简单的写一个发布订阅器
  8. html多行文本框_前端面试集锦 HTML篇
  9. json-ajax-jsonp-cookie
  10. java md5 密钥_Java 生成16/32位 MD5密钥串
  11. 鼠标按下改变RelativeLayout背景颜色,松开变回
  12. 如何去选取第一批要阅读的论文?_顶会最佳论文奖得主:初入科研领域,如何正确做科研?...
  13. js 获取浏览器版本
  14. Java语言的发展史
  15. PS动作怎么做爆炸火焰效果特效
  16. iap如何初始化_STM32F4-IAP学习笔记(一)
  17. BUUCTF:[INSHack2018]Self Congratulation
  18. 用PS制作黑白画效果
  19. 如何制作一款灵活的工单管理系统【推荐】
  20. Android很好看的登陆界面(包含详细代码)

热门文章

  1. 造车烧钱,服务烧钱,电池自燃,蔚来造车“火中如何取粟”
  2. 转发一篇好文:36氪翻译自medium的文章: 读书没有 KPI:为什么坚持“一年读 100 本书”没用?...
  3. nexues vpc 角色切换,引起staick 重置引起业务中断问题
  4. ADC采集电路前级为啥加一个电压跟随器?
  5. 从10亿个数字中找出最大的前100个数
  6. 登录注册与Cookie
  7. vue中mapGetters函数前面的三个点是什么意思?
  8. 游戏的轻度、中度、重度是什么意思
  9. AFEPack 使用 Tutorial(一):解二维泊松方程
  10. 管理信息系统基础知识点