Current location - Training Enrollment Network - Mathematics courses - The solar panels face the sun.
The solar panels face the sun.
Function [a, b]=sunangle(d, t, wei)

% This function calculates the declination angle of the sun according to Cooper equation, and then calculates the altitude angle h and azimuth gama.

% where the input parameter d is the d day of the vernal equinox.

% t was a 24-hour clock at that time.

% wei is the local latitude, and the input is angle, not radian.

% Output parameter A is the angle at which the vertical projection of the fixed central axis of the solar panel plane on the ground deviates from the local latitude.

% b is the angle between the plane where the solar panel is located and the horizontal plane, and the output is angle, not radian.

Wei = Wei * pi/180;

deta = 23.45 * sin(2 * pi * d/365)/ 180 * pi; The declination angle of% day is obtained from Cooper equation.

w =( 12-t)* 15 * pi/ 180; %w is the defined solar hour angle, which is positive in the morning and negative in the afternoon.

h = asin(sin(Wei)* sin(deta)+cos(Wei)* cos(deta)* cos(w); % solar altitude angle

r = acos((sin(h)* sin(Wei)-sin(deta))/(cos(h)* cos(Wei)); % solar azimuth

a =-r;

b = pi/2-h;

a = a * 180/pi;

b = b * 180/pi;

This is a degree to find the angle with matlab, for example, input >;; & gt[a,b]=sunangle(80,9,30)a = -9 1. 1553

b = 40.6 149

Then it shows that on the 80th day after the vernal equinox, the latitude of a place is 30 degrees, and at 9: 00 am, the deviation angle of the central axis of the solar panel plane from west to north is 1. 1553 degrees, and the angle between the solar panel and the horizontal plane is 40. 149 degrees.