mmpsim.m

来自「Matlab 6.0图形图像处理所附带的光盘」· M 代码 · 共 22 行

M
22
字号
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; endx=x(:).';						% make sure input is a rowi=find(abs(x)<.99&abs(x)<tol);  % find insignificant indicesx(i)=zeros(1,length(i));		% set them to zeroi=find(x~=0);					% find significant indicesif isempty(i) 	y=0;						% the extreme case: nothing left!else	y=x(i(1):length(x));		% start with first significant termend

⌨️ 快捷键说明

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