writein2.m

来自「偏最小二乘算法在MATLAB中的实现」· M 代码 · 共 28 行

M
28
字号
function [u2,y2] = writein2(u,y,n);
%WRITEIN2 Writes input and output matrices for dynamic model identificaton
%  This function writes files from process input and output vectors
%  that are the diagonal shifted type so that process models can
%  be obtained using PLS and other modelling methods. The
%  inputs are the original process input vector (u), the process
%  output vector (y), and the number of past inputs to consider (n).
%  The output of the function is the matrix of input sequences
%  (u2) and corresponding output vector (y2).
%  The I/O format is [u2,y2] = writein2(u,y,n); 
%
%  Note: for multiple input systems or systems with delays,
%  please see WRTPULSE. 


%  Copyright
%  Barry M. Wise
%  1991
%  Modified February 1994

[m,n2] = size(u);
newm = m-n+1;
u2 = zeros(newm,n);
for i = 1:n
  u2(:,i) = u(n-i+1:m-i+1,:);
end
y2 = y(n:m,:);

⌨️ 快捷键说明

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