0

I am trying create a plot(angle of incidence vs. time). Time is set between hour of sunrise to hour of sunrise (6:37:00 AM - 6:39:00 PM). I have to find angle of incidence for each minute interval starting from sunrise to sunset. The only issue is I don't have the faintest clue how to convert time into a number.

Angle of incidence depends on hour angle (Angle_hour). This is dependent on the time. Time before noon is given a negative value, and time after noon is positive. For example, at 6:37 am, the Hours would equal -6.62. On the other hand, 6:39 PM would equal 6.65. I am trying to have a for loop calculate the different values within the time frame.

 for k = 1:6

    Hours = k;

    Angle_Hour(k) = 15 * Hours;
    Angle_Incidence(k) = acos((sin(Angle_Declination) * sin     (Angle_Latitude) * cos(Angle_Slope)) - (sin(Angle_Declination) * cos(Angle_Latitude) * sin(Angle_Slope) * cos(Angle_SurfaceAzimuth)) + (cos(Angle_Declination) * cos(Angle_Latitude) * cos(Angle_Slope) * cos(Angle_Hour(k))) + (cos(Angle_Declination) * sin(Angle_Latitude) * sin(Angle_Slope) * cos(Angle_SurfaceAzimuth) * cos(Angle_Hour(k))) + (cos(Angle_Declination) * sin(Angle_Slope) * sin(Angle_SurfaceAzimuth) * sin(Angle_Hour(k)))) ;

 end

1 Answers1

0

If in your program the time in a day is a variable of type datetime, then you can either use datenum to turn the date to a number, or you can use the functions: hour, minute, second to extract the hours, minutes and seconds, and then calculate the angle using them.

So for example, you can have something like this:

function angle = Angle_Hour(k)
   hours = hour(k) + minute(k)/60 + second(k)/3600
   angle = % some expression/function of time in hours
end
Orielno
  • 409
  • 2
  • 8