gusucode.com > 信号处理工具箱 - signal源码程序 > signal\signal\signal\private\check_order.m
function [n_out, w, trivalwin] = check_order(n_in) %CHECK_ORDER Checks the order passed to the window functions. % [N,W,TRIVALWIN] = CHECK_ORDER(N_ESTIMATE) will round N_ESTIMATE to the % nearest integer if it is not alreay an integer. In special cases (N is [], % 0, or 1), TRIVALWIN will be set to flag that W has been modified. % Copyright (c) 1988-98 by The MathWorks, Inc. % $Revision: 1.1 $ $Date: 1998/06/03 16:14:36 $ w = []; trivalwin = 0; % Special case of negative orders: if n_in < 0, error('Order cannot be less than zero.'); end % Check if order is already an integer or empty % If not, round to nearest integer. if isempty(n_in) | n_in == floor(n_in), n_out = n_in; else n_out = round(n_in); warning('Rounding order to nearest integer.'); end % Special cases: if isempty(n_out) | n_out == 0, w = zeros(0,1); % Empty matrix: 0-by-1 trivalwin = 1; elseif n_out == 1, w = 1; trivalwin = 1; end