function [RES,RESY,I,isY]=NLIN_TPForecastGenFunc(index)

global TSTemp;

type=TSTemp.data{index}.type;
prevIndex=TSTemp.data{index}.prevIndex;
coeffs=TSTemp.data{index}.coeffs;

if prevIndex==0
    RES=['y=0; '; 'y1=0;']; RESY=''; I=index; isY=0;
else
    [RES,RESY,I,isY]=NLIN_TPForecastGenFunc(prevIndex);
    if CmpStr(type,'OnOX')==0
        RES=appendString(RES,['x=x/(' num2str(coeffs(1,1)) ');']);
    elseif CmpStr(type,'OnOY')==0
        RESY=appendString(['y=y*(' num2str(coeffs(1,2)) ');'],RESY);
    elseif CmpStr(type,'OnOXOY')==0
        RES=appendString(RES,['x=x/(' num2str(coeffs(1,1)) ');']);
        RESY=appendString(['y=y*(' num2str(coeffs(1,2)) ');'],RESY);
    elseif CmpStr(type,'onSubMiddle')==0
        RESY=appendString(['y=y+(' num2str(coeffs(1,2)) ');'],RESY);
    elseif CmpStr(type,'onExpOX')==0
        RES=appendString(RES,['x=exp(x);']);
    elseif CmpStr(type,'onLogOX')==0
        RES=appendString(RES,['x=log(x);']);
    elseif CmpStr(type,'PowCoord')==0
        A1=num2str(coeffs(1,1)); A2=num2str(coeffs(1,2)); A3=num2str(coeffs(1,3)); A4=num2str(coeffs(1,4));
        A5=num2str(coeffs(1,5)); A6=num2str(coeffs(1,6)); A7=num2str(coeffs(1,7));
        RES=appendString(RES,['y1=((((x-(' A3 '))/(' A4 ')).^(' A6 '))*(' A5 ')+(' A7 '))*(' A2 ')+(' A1 ');']);
%        RESY=appendString(['y=y*' A2 '+' A1 ';'],RESY);
    elseif CmpStr(type,'PowGMS')==0
        A1=num2str(coeffs(1,1)); A2=num2str(coeffs(1,2)); A3=num2str(coeffs(1,3));
        RES=appendString(RES,['y1=(x*(' A3 ')+(' A2 ')).*x+(' A1 ');']);
    elseif CmpStr(type,'TrigFunc')==0
        A1=num2str(coeffs(1,1)); A2=num2str(coeffs(1,2)); A3=num2str(coeffs(1,3));
        RES=appendString(RES,['y1=(' A1 ')*cos(x*(' A2 ')+(' A3 '));']);
    elseif CmpStr(type,'DelSub')==0
        if isY==0
            RES=appendString(RES,'y=y1;');
        elseif isY==2
            RES=appendString(RES,'y=y*y1;');
        else
            RES=appendString(RES,'y=y+y1;');
        end
        isY=1;
    elseif CmpStr(type,'DelDiv')==0
        if isY==0
            RES=appendString(RES,'y=y1;');
        elseif isY==2
            RES=appendString(RES,'y=y*y1;');
        else
            RES=appendString(RES,'y=y+y1;');
        end
        isY=2;
    end
end