function[Y,TP,dates_m]= yield_decomp_m(tmp,dates,yields_m,varargin)
if isempty(varargin)
    d_t=0;
else
    d_t=varargin{1};
end
TP1mth=tmp(:,1);
TP3mth=tmp(:,2);
TP6mth=tmp(:,3);
TP1yr=tmp(:,4);
TP5yr=tmp(:,5);
TP10yr=tmp(:,6);
TP_monthly=timetable(dates(2:end),TP1mth,TP3mth,TP6mth,...
    TP1yr,TP5yr,TP10yr);
 Y1mth=yields_m(2:end,1); 
 Y3mth=yields_m(2:end,2); 
 Y6mth=yields_m(2:end,3); 
 Y1yr=yields_m(2:end,4); 
 Y5yr=yields_m(2:end,8); 
 Y10yr=yields_m(2:end,end); 
Y_monthly=timetable(dates(2:end),Y1mth,Y3mth,Y6mth,...
    Y1yr,Y5yr,Y10yr);

TP=TP_monthly.Variables;
Y=Y_monthly.Variables;
dates_m=(TP_monthly.Properties.RowTimes);
if d_t==1
    TP=detrend(TP,'Constant');
elseif d_t==2
     TP=detrend(TP,'Linear');
elseif d_t==3
    [~,TP]=hpfilter(TP,14400);
    
end