?? functionchaospredict.m
字號:
%AOLMM多步預(yù)測函數(shù)
function [FChaosPredict] = FunctionChaosPredict(Data,N,mtbp,deltaT,tao,d,MaxStep)
%Data是一維信號時間序列,N是信號數(shù)據(jù)長度,mtbp,deltaT,tao,d分別是重構(gòu)相空間的平均時間序列、采樣周期、時延及嵌入維
roll=Data;%取橫搖數(shù)據(jù)
M = N - (d - 1)*tao;
for i = 1 : M
for j = 1 : d
MatrixX(i,j) = roll(i + (j - 1)*tao);
end
end
%計算相空間中第M點(diǎn)與各點(diǎn)的距離
for j = 1 : (M - 1)
Dis(j) = norm(MatrixX(M,:) - MatrixX(j,:),2);
end
%排序計算相空間中第M點(diǎn)的(m+1)個參考鄰近點(diǎn)
for i = 1 : (d + 1)
NearDis(i) = Dis(i);
NearPos(i) = i;
end
for i = (d + 2) : (M - mtbp)
for j = 1 : (d + 1)
if (abs(i-j)>mtbp) %& abs(i-j)<10*mtbp
if(Dis(i) < NearDis(j))
NearDis(j) = Dis(i);
NearPos(j) = i;
break;
end
end
end
end
SortedDis = sort(NearDis);
MinDis = SortedDis(1);
%計算第M點(diǎn)的(m+1)個參考鄰近點(diǎn)的權(quán)P[i]
SumP = 0;
for i = 1 : (d + 1)
P(i) = exp(-NearDis(i)/MinDis);
SumP = SumP + P(i);
end
P = P/SumP;
%用最小二乘法計算a[],b[]
for step=1:1:MaxStep
aCoe1 = 0;
aCoe2 = d;
bCoe1 = 0;
bCoe2 = 0;
e = 0;
f = 0;
for i = 1 : (d + 1)
aCoe1 = aCoe1 + P(i)*sum(MatrixX(NearPos(i),:));
bCoe1 = bCoe1 + P(i)*(MatrixX(NearPos(i),:)*MatrixX(NearPos(i),:)');
e = e + P(i)*(MatrixX(NearPos(i) + step,:)*MatrixX(NearPos(i),:)');
f = f + P(i)*sum(MatrixX(NearPos(i) + step,:));
end
bCoe2 = aCoe1;
CoeMatrix = [aCoe1,bCoe1;aCoe2,bCoe2];
ResultMatrix = [e;f];
abResult = CoeMatrix\ResultMatrix;
a = abResult(1);
b = abResult(2);
%----------------------------------------------
for j = 1 : d
% MatrixX(M + step,j) = a + b*MatrixX(M,j); %以歷史上相近點(diǎn)的演化規(guī)律作為中心點(diǎn)的演化規(guī)律以中心點(diǎn)為基準(zhǔn)進(jìn)行預(yù)報
MatrixX(M + step,j) = 0;
for i = 1 : (d + 1)
MatrixX(M + step,j) = MatrixX(M + step,j) + P(i)*(a + b*MatrixX(NearPos(i),j)); %以歷史上相近點(diǎn)的演化加權(quán)和直接作為中心點(diǎn)的演化點(diǎn)進(jìn)行預(yù)報
end
end
%---------------------------------------------------
%MatrixX(M + step,d)=a+b*roll(N);
PredictedData(step) = MatrixX(M + step,d);
FChaosPredict(step) = PredictedData(step);
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -