Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Recitation A #7 Please complete all of the following and submit your code next w

ID: 3808319 • Letter: R

Question

Recitation A #7 Please complete all of the following and submit your code next week in recitation. You may work in your groups, but must submit code independently. Please show example inputs and outputs for each program. 1. Create a function that calculates the incident angle of the sun's rays at solar noon (the highest point of the sun in the sky) given a certain latitude and a certain day of the year Plane parallel with earth's surface at location Sun's rays I The incident angle depends on two things. The first is the declination angle, which is the angle of incidence of the sun at the equator. For a given day, the equation for declination angle is 284 day 23.45 sin 2n 362.5 Where the day is an integer from 1 to 365, where 1 is January 1 and 365 is December 31 Note that the argument of the sine function is in radians, but the declination angle (5) we get is in degrees Once we know the declination angle, the magnitude of the incident angle (ei is given as cos cos 5 cos latitude sin sin latitude Where 5 and latitude are in degrees. Note that ei is negative when latitude 5 0 and positive otherwise. An angle of 0 means that the sun's rays are perpendicular to the ground. A negative angle means the rays are angled towards the north, and a positive value means that the sun's rays are angled towards the south. A magnitude of more than 90 degrees means that that latitude receives no sunlight on that day! For example, on at latitude 40 on the 60 day of the year, the (inputs 40 and 60) your program should return the angle -47.3913. Useful hints: There are different commands for sinusoid functions depending on whether the input is in radians (sin) or degrees (sind Be careful to use the correct ones for this program.

Explanation / Answer

1)

function incident_angle = cal_inci_angle(day,latitude)

numerator=284+day;
temp=numerator/362.5;
temp_angle=2*pi*temp;
declination_angle=23.45*sin(temp_angle);
cos_incident_angle=(cosd(declination_angle)*cosd(latitude))+(sind(declination_angle)*sind(latitude));
incident_angle=acosd(cos_incident_angle);
if any((latitude-declination_angle) > 0)
    incident_angle=incident_angle*(-1);
end
end