function [month, day] = monthday( year, jday )
% the month and the day given the julian day
%
% input:
%        year, an integer, the year, e.g. 2010
%        jday, an integer, the julian day
%
% output:
%        month, an integer, the month, with January being 1
%        day, an integer, the day of the month, starting at 1
%
daysinmonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
leap = isleap(year);
day=jday;
for i = [1:12]
    dim=daysinmonth(i);
    if( leap && (i==2) )
        dim=dim+1;
    end
    if( day <= dim )
        break;
    end
    day = day - dim;
end
month=i;
return

        




