📄 wrtpulse.m
字号:
function [newu,newy] = wrtpulse(u,y,n,delay);
%WRTPULSE Creates input/output matrices for dynamic model identification
% This function rewrites vectors of system inputs and output
% so that they may be used with the PLS and other modelling
% routines to obtain finite impulse response and ARX models.
% The inputs are the input vector or matrix of input vectors (u),
% (where the each input is a column vector), the process output
% vector (y), a scalar or vector of number of past periods to
% consider for each input (n), and a scalar or vector of delays
% corresponding to each input (delay). The output of the
% function is a matrix of lagged input variables (newu) and
% corresponding output vector (newy).
% The I/O format is: [newu,newy] = wrtpulse(u,y,n,delay);
% Copyright
% Barry M. Wise
% 1991
% Modified February 1994
[mu,nu] = size(u);
[my,ny] = size(y);
% Check to see that matrices are of consistant dimensions
if nu > mu
error('the input u is supposed to be colmn vectors')
end
if ny ~= 1
error('the output y is supposed to be a colmn vector')
end
if mu ~= my
error('There must be an equal number of points in the input and output vectors')
end
% Find maximum number of terms for all inputs
a = max(n+delay);
% Write out file using maximum number of terms
for i = 1:nu
[temp,newy] = writein2(u(:,i),y,a);
% Delete proper number of columns according to delay and # of coeffs
temp = temp(:,delay(:,i)+1:n(:,i)+delay(:,i));
% Construct total matrix from each input part
if i == 1
newu = temp;
else
newu = [newu temp];
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -