我有一个文件,这是一个房子的能源消耗。每 10 分钟一个值(瓦特):
10:00 123
10:10 125
10:20 0
...
这意味着每天有 144 个值(行)。我想用 ARX 和 ARMAX 程序预测第二天的能量。我确实在 Matlab 中编写了 ARX 代码。但我无法预测第二天。我的代码采用最后 5 次消费并预测第 6 次。我如何预测下一个 144 值(= 后天)
% ARX Process----------------------------
L=length(u_in)
u_in_ID=u_in;% Input data used for Identification
u_in_vfy=u_in;% Input data used for verification
y_out_ID=y_out;% Output data used for Identification
y_out_vfy=y_out;%Output data used for verification
m=5; %Parameter to be used to generate order of delay for Input, Output and Error
n=length(y_out_ID)-m;
I=eye(n,1)+1;
I(1)=I(1)-1;
A=I; % Initialize Matrix A
Y=y_out_ID((m+1):end); % Defining Y vector
length(Y)
na=1;
% Put output delay 1 to m-na in A matrix
for k=1:1:m-na
A=[A y_out_ID((m-k+1):(end-k))];
end
% Put "Current Input -- mth delayed Input" to Matrix A
for p=1:1:m
k=p-1;
A=[A u_in_ID((m-k+1):(end-k))];
end
A(:,1)=[]; % Delete 1st column of Matrix A, which was used to Initialize it
parsol=inv(A'*A)*A'*Y;
BB=A*parsol;
% Generate Identified Output vector based on previous
% outputs, current and previous Inputs and Parameters solved by Least
% square method
n=length(y_out_vfy)-m;
I=eye(n,1)+1;
I(1)=I(1)-1;
A=I;
for k=1:1:m-na
A=[A y_out_vfy((m-k+1):(end-k))];
end
for p=1:1:m
k=p-1;
A=[A u_in_vfy((m-k+1):(end-k))];
end
A(:,1)=[]; % Delete 1st column of Matrix A, which was used to Initialize it
A;
y_out_sysID=A*parsol;
谁能帮我?