www.pudn.com > 精通Matlab综合辅导与指南-源程序.zip > mmpsim.m


function y=mmpsim(x,tol)
%MMPSIM Polynomial Simplification, Strip Leading Zero Terms.
% MMPSIM(A) Deletes 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.  

% D.C. Hanselman, University of Maine, Orono ME,  04469
% 3/4/95
% 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)