正在加载图片...
>)mmp2str(b,[], 1) 20°(S^3+7s^2+16s^1+13) >)mmp2str(b, 'x', 1) 20°(x~3+7x^2+16x^1+13) 这里函数 mmpsim删除在多项式n中近似为零的第一个系数。函数mmp2st把数值多 项式变换成等价形式的字符串表达式。该两个函数的主体是: function y o MMPSIM Polynomial Simplification, Strip Leading Zero Terms MMPSIM(A) Delets leading zeros and small coefficients in the polynomial A(s) Coefficients are considered small if their o magnitude is less than both one and norm(A)*1000*eps MMPSIM(A, TOL) uses TOL for its smallness tolerance Copyright(c)1996 by Prentice-Hall, Inc if nargin<2, tol=norm(x)*1000*eps;end X-XI make sure input is a row ifind(abs(x)<.99&abs(x)<tol); find insignificant indices x(i=zeros(l, length(i)) set them to zero find significant indices if isempty(i) extreme case: nothing left else x(i(1): length(x)) start with first term end and go to end of polynomial function s=mmp2str(p, v, ff) MMP2STR Polynomial Vector to String Conversion MMP2STR(P)converts the polynomial vector P into a string For example: P=[2 3 4 becomes the string 2+ 3s+ 4 o MMP2STR(P, V) generates the string using the variable V instead ofs. MMP2STR(2 4, z)becomes '2z2+ 3z+4 o MMP2STR(P, V, 1)factors the polynomial into the product of a» mmp2str(b , [ ] , 1) ans = -20*(s^3 + 7s^2 + 16s^1 + 13) » mmp2str(b , ' x ' , 1) ans = -20*(x^3 + 7x^2 + 16x^1 + 13) 这里函数 mmpsim 删除在多项式 n 中近似为零的第一个系数。函数 mmp2str 把数值多 项式变换成等价形式的字符串表达式。该两个函数的主体是: function y=mmpsim(x,tol) % MMPSIM Polynomial Simplification,Strip Leading Zero Terms. % MMPSIM(A) Delets leading zeros and small coefficients in the % polynomial A(s). Coefficients are considered small if their % magnitude is less than both one and norm(A)*1000*eps. % MMPSIM(A,TOL) uses TOL for its smallness tolerance. % Copyright (c) 1996 by Prentice-Hall,Inc. if nargin<2, tol=norm(x)*1000*eps; end x=x(:).' ; % make sure input is a row i=find(abs(x)<.99&abs(x)<tol) ; % find insignificant indices x(i)=zeros(1, length(i)) ; % set them to zero i=find(x~=0) ; % find significant indices if isempty(i) y=0 ; % extreme case: nothing left! else y=x(i(1) : length(x)) ; % start with first term end % and go to end of polynomial function s=mmp2str(p,v,ff) % MMP2STR Polynomial Vector to String Conversion. % MMP2STR(P) converts the polynomial vector P into a string. % For example: P = [2 3 4] becomes the string ' 2s^2 + 3s + 4 ' % % MMP2STR(P,V) generates the string using the variable V % instead of s. MMP2STR([2 3 4],' z ') becomes ' 2z^2 + 3z + 4 ' % % MMP2STR(P,V,1) factors the polynomial into the product of a
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有