📄 mgtsdemo.html
字号:
<!--This HTML is auto-generated from an m-file.Your changes will be overwritten.--><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:x-large">Chaotic Time Series Prediction</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Chaotic time series prediction using ANFIS.</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Copyright 1994-2002 The MathWorks, Inc.$Revision: 1.15 $</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium;">Overview</p><ul xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd"><li><a href="#Error curves">Error curves</a></li><li><a href="#Comparisons">Comparisons</a></li><li><a href="#Prediction errors of ANFIS">Prediction errors of ANFIS</a></li></ul><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">The Mackey-Glass time-delay differential equation is defined by</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">dx(t)/dt = 0.2x(t-tau)/(1+x(t-tau)^10) - 0.1x(t)</pre><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">When x(0) = 1.2 and tau = 17, we have a non-periodic andnon-convergent time series that is very sensitive toinitial conditions. (We assume x(t) = 0 when t < 0.)</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">load mgdata.data=mgdata;time = a(:, 1);ts = a(:, 2);plot(time, ts);xlabel(<span style="color:#B20000">'Time (sec)'</span>); ylabel(<span style="color:#B20000">'x(t)'</span>);title(<span style="color:#B20000">'Mackey-Glass Chaotic Time Series'</span>);</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="mgtsdemo_img_02_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Now we want to build an ANFIS that can predict x(t+6) fromthe past values of this time series, that is, x(t-18), x(t-12),x(t-6), and x(t). Therefore the training data format is</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">[x(t-18), x(t-12), x(t-6), x(t); x(t+6]</pre><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">From t = 118 to 1117, we collect 1000 data pairs of the aboveformat. The first 500 are used for training while the othersare used for checking. The plot shows the segment of the timeseries where data pairs were extracted from.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">trn_data = zeros(500, 5);chk_data = zeros(500, 5);<span style="color:green">% prepare training data</span>start = 101;trn_data(:, 1) = ts(start:start+500-1);start = start + 6;trn_data(:, 2) = ts(start:start+500-1);start = start + 6;trn_data(:, 3) = ts(start:start+500-1);start = start + 6;trn_data(:, 4) = ts(start:start+500-1);start = start + 6;trn_data(:, 5) = ts(start:start+500-1);<span style="color:green">% prepare checking data</span>start = 601;chk_data(:, 1) = ts(start:start+500-1);start = start + 6;chk_data(:, 2) = ts(start:start+500-1);start = start + 6;chk_data(:, 3) = ts(start:start+500-1);start = start + 6;chk_data(:, 4) = ts(start:start+500-1);start = start + 6;chk_data(:, 5) = ts(start:start+500-1);index = 118:1117+1; <span style="color:green">% ts starts with t = 0</span>plot(time(index), ts(index));axis([min(time(index)) max(time(index)) min(ts(index)) max(ts(index))]);xlabel(<span style="color:#B20000">'Time (sec)'</span>); ylabel(<span style="color:#B20000">'x(t)'</span>);title(<span style="color:#B20000">'Mackey-Glass Chaotic Time Series'</span>);</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="mgtsdemo_img_03_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">We use GENFIS1 to generate an initial FIS matrix from trainingdata. The command is quite simple since default values forMF number (2) and MF type ('gbellmf') are used:</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px"> fismat = genfis1(trn_data);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -