function out= ss_interp (var)

% var - 1-minute variation array of the magmetic field
% out - smoothed period

day_points =1440; % 1-minute data
%day_points =288; % 5-minute data

% days
days = length(var)/day_points;

% fild daily median value
 for i=1:days
     day_med(i) = nanmedian(var((i-1)*day_points+1:(i)*day_points));
 end
% smooth medians      
     
     w = smooth(day_med,7,'moving'); %7days     
     w = smooth(w,7,'rloess');
     
% interpolation to day point
 
out =interp1([1:days],w,[1:1/day_points:days+1],'spline','extrap');
out(length(out)-1)=[];