正在加载图片...
o constant and a monic polynomial %MMP2STR([234],[],1) becomes2(s^2+1.5s+2) Copyright(c)1996 by Prentice-Hall, Inc if nargin<3. ff=0: end factored form is False if nargin <2. v='s': end default variable is's if isempty(v).v='s': end default variable is variable must be scalar p=mmpsim(p); %o strip insignificant terms length(p) put in factored form K=p(1); Ka=abs( K): p=p/k if abs(K-1)<1e-4 pp=[;pe=[] seif abs(K+1)<le-4 elseif abs(Ka-round(Ka))<=1e-5*Ka pp=lsprintf('%.0f,K)(; pe=); else pp=[sprintf(%.4g,K)*(]; pe=") not factored form pp=sprintf(%.4g,K) ifn=l polynomial is just a constant s=sprintf(%. 4g, K) return s=lpp sprintf(%.Of', n-1); begin string construction for j=2.n- %o catenate center terms in polynomial if p(i)<0, pm=-; else, if p(i)0, pm=: end fp(i==l, pp=[ else, pp=sprintf(%.4g, abs(p(i)); end if p(i)=0, s-s pm pp f(%of, n-1); end fp(n)=0, pp=sprintf(%.4g, abs((n))); else, pp=[]; end if p(n)<0, pI elseif p(n)>0, pm='+'; else, pm=[I ;end% constant and a monic polynomial. % MMP2STR([2 3 4],[ ],1) becomes ' 2(s^2 + 1.5s + 2) ' % Copyright (c) 1996 by Prentice-Hall,Inc. if nargin<3, ff=0; end % factored form is False if nargin <2, v=' s ' ; end % default variable is ' s ' if isempty(v), v=' s ' ; end % default variable is ' s ' v=v(1) ; % variable must be scalar p=mmpsim(p) ; % strip insignificant terms n=length(p) ; if ff % put in factored form K=p(1) ; Ka=abs(K) ; p=p/K; if abs(K-1)<1e-4 pp=[ ]; pe=[ ] ; elseif abs(K+1)<1e-4 pp=' -(' ; pe= ') ' ; elseif abs(Ka-round(Ka))<=1e-5*Ka pp=[sprintf(' %.0f ', K) '*( ' ] ; pe= ') ' ; else pp=[sprintf(' %.4g ' , K) '*(' ] ; pe= ') ' ; end else % not factored form K=p(1); pp=sprintf(' %.4g ' , K) ; pe=[ ]; end if n==1 % polynomial is just a constant s=sprintf(' %.4g ',K); return end s=[pp v ' ^ ' sprintf(' %.0f ',n-1)]; % begin string construction for i=2:n-1 % catenate center terms in polynomial if p(i)<0, pm= ' - ' ; else, if p(i)<0,pm= ' ; end if p(i)= =1,pp=[ ] ; else, pp=sprintf(' %.4g ', abs(p(i))) ; end if p(i)~ =0,s=[s pm pp v ' ^ ' sprintf(' %.0f ',n-i)] ; end end if p(n)~ =0,pp=sprintf(' %.4g ',abs(p(n))); else, pp=[ ]; end if p(n)<0 , pm= ' - ' ; elseif p(n)>0 , pm= ' + ' ; else, pm=[ ]; end
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有