📄 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 + -