cartprod.m

来自「国外一款非线性估计的工具箱」· M 代码 · 共 36 行

M
36
字号
function vect = cartprod(argin)% CARTPROD%   The function computes the cartesian product of axis grids stored in%   axgrids variable of the cell-array type. axgrids{i} is a vector of%   grid points in the i-th state coordinate; i=1,...,n. The output of the%   function is a n-times-N matrix containing grid points of dimension n%   stored as column vectors; N is the total number of grid points and is%   computed as the product of axis grid lengths.%%   The input argument can be either the axgrids variable itself, or an%   object of class pmpdf% Nonlinear Filtering Toolbox version 2.0rc1% Copyright (c) 1995 - 2007 NFT developement Team,%              Department of Cybernetics,%              University of West Bohemia in Pilsenif isa(argin,'pmpdf')    axgrids = axisgrids(argin);else    axgrids = argin;endn = length(axgrids);N = zeros (1,n);for i=1:n    N(i) = length(axgrids{i});endvect(1,:) = expand(axgrids{1}, prod(N(2:n)));for i=2:n    e = expand(axgrids{i}, prod(N(i+1:n)));    vect = [vect; repmat(e,1,prod(N(1:i-1)))];end

⌨️ 快捷键说明

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