function xdes=deseas(xx)

if isa(xx,'tsmat')
    x=xx.matdata;
    xdes=xx;
else
    x=xx;
end

    
xds=x;
[T,N]=size(x);
trend=(1:T)';
pippo=1;
for t=1:T
    if mod(t,13)==0
        pippo=pippo+1;
    end
         trend_s(t,1)=pippo ;       
end    


dummies=[];
dummiest=[];
for j=1:12;
    dum=center(ismember(trend,j:12:T)); 
    dumt = dum.*trend_s;
    dummies=[dummies,dum];
    dummiest=[dummiest,dumt];
end    

XX=[ones(T,1),trend_s,dummies(:,1:11),dummiest(:,1:11)];
for j=1:N
    y=x(:,j);
    ciccio=find(isfinite(y));
    y=y(ciccio);
    XXr=XX(ciccio,:);
beta   = XXr \ y;
yfit= [XXr]*beta;
xds(ciccio,j)=y-yfit+beta(1)+beta(2)*trend_s(ciccio);
end

if isa(xx,'tsmat')
% keyboard;
xdes.matdata=xds;
else
    xdes=xds;
end





