fillb.m

来自「剑桥大学用于线性和双线性动力学系统辨识的工具箱」· M 代码 · 共 50 行

M
50
字号
function [B,k] = fillb(Bind,m,par,ki)%FILLB   Fills the B matrix with estimates.%%   [B,k] = FILLB(Bind,m,par,ki) fills matrix B with estimates beginning in%   par(ki) and ending in par(k-1). B is a matrix with m columns and as many%   rows as elements in Bind. Bind(j) contains the index of the first%   element in the j'th row of B which is non-zero. B is such that the first%   non-zero element of each row is strictly positive. It is assumed that%   each row of B is non-zero.%%   See also SIGNEXTB.%% CUED System Identification Toolbox.% Cambridge University Engineering Department.% Copyright (C) 1998-2002. All Rights Reserved.% Version 1.00, Date: 01/06/2002% Created by H. Chen and E.C. Kerrigan.if any(Bind > m)  disp('Indices in Bind are not allowed to be larger than number of columns m in B.')  error(' ')endif size(Bind,2) > 1  disp('Bind has to be a column vector.')  error(' ')endtotal = sum(m-Bind+1);if total > length(par) - ki + 1  disp('Not enough elements in par to fill B.')  error(' ')endn = length(Bind);  B = zeros(n,m);k = ki;for j = 1:n % Extract the elements row-wise  B(j,Bind(j)) = exp(par(k)); % Guarantees that the first non-zero element in							  % row j is strictly positive. See SIGNEXTB  k = k + 1;  for i = Bind(j)+1:m  % Go through the rest of the columns    B(j,i) = par(k);   % Any sign allowed	k = k + 1;  endend

⌨️ 快捷键说明

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