?? ttsf.m
字號:
% TO RUN
% ---------
% mydata = mgts(3000);
% n = 0;
% RMSE = ttsf(mydata)
function RMSE = ttsf(mydata) % Test Time Series Forecasting
global TR;
TR = 0;
% Plot My Data
t=1001:2000;
subplot(3, 1, 1);
plot(t, mydata)
h = legend('My Data', 1);
%---------------------------------------------
% Plot Fuzzy Sets
x = 0:0.01:2;
fs = fsloc(x);
subplot(3, 1, 2);
plot(x, fs)
h = legend('Fuzzy Sets', 1);
%---------------------------------------------
% Invoking Forecasting
L=400; % No. of Test Points
for np = 1:L
fc(np+505) = st1(mydata, np);
end
% ---------------------------------------------
% Plot Forecasted & Test Data Simultaneously
t = 505:505+L;
tsd = mydata(505:505+L);
fcd = fc(505:505+L);
subplot(3, 1, 3);
plot(t, fcd, '-k', t, tsd, '-.b')
h = legend('Forecast','Test Data',2);
% --------------------------------------------
% Calculation of Root Mean Square Value
ErrS = 0;
for t=1:L
ErrS = ErrS + (tsd(t) - fcd(t))^2;
end
RMSE = sqrt(ErrS/L);
% --------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -