function [ndayofyear] = ddoy(month,day)
%given month and day return dayofyear 
%[ndayofyear] = ddoy(month,day)
%
%non-leap year only
%days ='jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec';
 dayv= [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
sum=0;
%if (fix(year/4)*4 -year ==0) 
%  dayv(2)=29;  % leapyear
%end
  for i=1:month-1;
    sum = sum + dayv(i);
  end
sum = sum+day;
ndayofyear=sum;
