⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subsref.m

📁 几个关于多小波的程序
💻 M
字号:
function Pi = subsref(P,S)

% SUBSREF -- subscripting of matrix polynomial objects
% 
% This function is not meant to be called by the user, except from
% subroutines residing in the @mpoly directory. It is called by
% Matlab to evaluate one of the following:
% 
%        P.field   = returns one of the fields of P, which are
%                        min    = smallest exponent
%                        max    = largest exponent
%                        coef   = matrix of coefficients
%                        length = max - min + 1 = number of coefficients
%                        degree = matrix degree = length - 1
%                        size   = size of coefficient matrices
%                        type   = type ('', 'symbol' or 'polyphase')
%                        m      = dilation factor
%                        r      = multiplicity
%
%        P(index1,index2)  = returns matrix polynomial of submatrices
%
%        P(x)  = evaluates P at index; same as mpolyval(P,index)
%
%        P{index}  = returns one of the coefficient matrices
%                    For convenience, reference to a non-existing
%                    coefficient is allowed, and returns a zero matrix.
%
% For example, if 
%
%            (1 2 3)   (3 2 1)     (1 0 0)  2
%        P = (4 5 6) + (6 5 4) z + (0 1 0) z ,
%            (7 8 9)   (9 8 7)     (0 0 1)
% 
% then
%
%                     (2 3)   (2 1)     (0 0)  2
%        P(1:2,2:3) = (5 6) + (5 4) z + (1 0) z ,
%
% and
%               (3 2 1)
%        P{1} = (6 5 4)
%               (9 8 7)
%
% Nested calls, such as P{1}(1,:) are handled by calling subsref
% recursively.

% Copyright (c) 2004 by Fritz Keinert (keinert@iastate.edu),
% Dept. of Mathematics, Iowa State University, Ames, IA 50011.
% This software may be freely used and distributed for non-commercial
% purposes, provided this copyright statement is preserved, and
% appropriate credit for its use is given.
%
% Last update: Feb 20, 2004

switch S(1).type
    
 case '.' % access to one of the fields
  Pi = get(P,S(1).subs);
      
 case '()' 
  if (length(S(1).subs) == 1)
% evaluation
      Pi = mpolyval(P,S(1).subs{1});
  else
% select submatrix
      Pi = P;
      Pi.coef = Pi.coef(S(1).subs{:},:); 
      Pi = trim(Pi);
  end
  
 case '{}' % select one coefficient matrix
  if (length(S(1).subs) > 1)
      error('{} subscript must be a single integer');
  end
  true_index = S(1).subs{1} - P.min + 1;
  if (true_index >= 1 & true_index <= size(P.coef,3))
      Pi = P.coef(:,:,true_index);
  else
      Pi = zeros(size(P.coef,1),size(P.coef,2));
      if (isa(P.coef,'sym'))
	  Pi = sym(Pi);
      end
  end
 otherwise
  error('this should not happen')
end

% the following code allows the possibility of multiple subscripts,
% such as P{3}(2,:).

if (length(S) > 1)
    Pi = subsref(Pi,S(2:end));
end



⌨️ 快捷键说明

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