ratio2s.m

来自「基于MATLAB的辅助设计 简述了矩阵分析的重要性」· M 代码 · 共 41 行

M
41
字号
function st = ratio2s(poly)

% RATIO2S is a function which transfor a polynomie in matlab
% format  to a polynomie in ratio of s.

%    Author:  Ole Barup Sorensen, Rapid Data Ltd 

%    Copyright (c) 1989-94 by Rapid Data Ltd
%    Revision 14:57  26/01/94

run=1;
lp = length(poly);
st = [];
mv = 1;

for i = 1:lp,
  if (run == 1) & (poly(i) ~= 0),
    if (i ~= lp) & (poly(i) == 1),
      % do nothing
    else    
      st = [st , num2str(poly(i))];
    end  
    run = 2;
  else
    if (i ~= lp)&(poly(i) == 1),
      st = [st , '+'];
    elseif poly(i)>0,
      st = [st , '+', num2str(poly(i))];
    elseif poly(i)<0,  
      st = [st , num2str(poly(i))];
    end
  end
  if poly(i)~=0,
    if (lp-i)>1,
      st = [st , 's', num2str((lp-i))];
    elseif (lp-i) == 1,
      st = [st, 's'];
    end
  end
end

⌨️ 快捷键说明

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