//
//fourie command.
//
//This command is used for fourie transform.
//
//Syntax
fourie data/
(options)
;
//Options
method=/fourie/fft //fourie:fourie(defalut) fft:fast fourie transform.
kind=/trans/period/rev //trans:fourie coefficent period(default):frequency spectrum rev:reverse fourie
predict=xx //xx is predicting period using fourie transform(default 0).
//Example 1 fourie transform and reverse fourie transform which transform a wave to the spectrum and same wave.
get stockdata.csv@;
fourie data1/
method=fft
kind=trans
;
anaput freqData;
get freqData;
fourie freqData/
kind=rev
;
anaput wave;
get wave;
plot line data1;
//Example 2
get stockdata.csv@;
plot line data1;
if(# > 229) delrec //This wave has 250 steps,and 229 steps are trainning step.
put train;
//use tmtrend command for fitting 229 step and predicting 21 step using 4 degree spline.
get train;
tmtrend data1/
dim=4
period=21
;
anaput traintrend;
get traintrend;
plot line data1 data1_T dataTC;
//data1 is original wave;
//data1_T is the spline curve fitting orignal wave;
//data1TC is different value meaning data1 - data_T.
//using fourie transform for steady long period fitting with cuting higher frequency.
fourie data1TC/
method=fft
kind=trans
predict=21
;
anaput freqData;
plot line data1TC/
color=blue
;
//Cuting 30 higher frequency to get long period curve
get freqdata;
if(# >= 30) data1TC=0;
put cutData;
//Reverse fourie transform to get long preiod curve.
get cutData;
fourie data1TC/
kind=rev
;
anaput cutWave;
get cutWave;
//rename logn frequency curve.
attr name rename/
data1TC data1FR
;
plot line data1FR;
//ploting long period curve to difference value of data1 and trend.
merge trainTrend by #;
plot line data1 data1_T data1TC data1FR;
put data1FRQ;
//In the Figuer data1FR curve is long period curve for fitting difference value.