% function [S,FqS,Q,Hq,TAUq,Q2,ALPHA,FALPHA]=demoMFDFA(X)
function demoMFDFA(X)

[m,n]=size(X);
if (n==1) X=X'; [m,n]=size(X); end
windowWidthBegin=5;
windowWidthEnd=fix(n/4);
POWERS=[-20 -15 -10 -6 -5 -4 -3 -2 -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1...
        0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 2 3 4 5 6 10 15 20];

[S,FqS,Q]=MFDFA(X,windowWidthBegin,windowWidthEnd,POWERS,1,'COUNTRATIO','50');

f1=figure;
loglog(S,FqS,'.');
f1Axes=get(f1,'CurrentAxes');
set(get(f1Axes,'XLabel'),'String','s','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');
set(get(f1Axes,'YLabel'),'String','F_q(s)','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');


[Hq,TAUq,Q2]=MFDFAHTau(S,FqS,Q);

f2=figure;
plot(Q2,Hq,'.');
f2Axes=get(f2,'CurrentAxes');
set(get(f2Axes,'XLabel'),'String','q','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');
set(get(f2Axes,'YLabel'),'String','h(q)','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');

f3=figure;
plot(Q2,TAUq,'.');
f3Axes=get(f3,'CurrentAxes');
set(get(f3Axes,'XLabel'),'String','q','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');
set(get(f3Axes,'YLabel'),'String','\tau(q)','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');

[ALPHA,FALPHA]=MFDFAAlphaFTAU(Q2,TAUq);
f4=figure;
plot(ALPHA,FALPHA,'.');
f4Axes=get(f4,'CurrentAxes');
set(get(f4Axes,'XLabel'),'String','\alpha','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');
set(get(f4Axes,'YLabel'),'String','f(\alpha) from \tau(q)','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');

[ALPHA2,FALPHA2]=MFDFAAlphaFH(Q2,Hq);
f5=figure;
plot(ALPHA2,FALPHA2,'.');
f5Axes=get(f5,'CurrentAxes');
set(get(f5Axes,'XLabel'),'String','\alpha','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');
set(get(f5Axes,'YLabel'),'String','f(\alpha) from H(q)','FontAngle','italic','FontName','times new roman','FontSize',14,...
                         'FontWeight','bold');

clear m n windowWidthBegin windowWidthEnd POWERS STEP RATIO f1Axes;
clear f2Axes f3Axes f4Axes;