📄 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; 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -