I need help with my function file

function [SEA] = solarelevation(phi, L, n, T)
%--------------------------------------------------------------------------
% Author(s):
% Date: Day-Month-Year (e.g, 13-Feb-2015)
%--------------------------------------------------------------------------
% Function Description:
% ---Inputs---
% Input1: phi - Latitude in degrees
% Input2: L - Longitude of degrees
% Input3: A -
% Inout4: z - height in Km
% Input5: dayOfYear
% Input6: Time hours in calc
% ---Outputs---
% Output1:SEA - Solar elevation angle
%%Step 1: Calculate D, solar declination
%
% slove for d
d = ((n-1)*360)/365.242;
%solve for l inin degrees
l = 279.9348 + d; % sole for l in deg
% solve for sigma in degrees
sigma = l + 0.4087*sind(l) + 1.8724*cosd(l) - 0.0812*sind(2*l) + ...
0.0083*cosd(2*l);
% solve for sin D in degrees
D = asind( sind(23.44383) * sind(sigma));
% Calculate M
M = 12 + 0.123570*sind(d) - 0.004289*cosd(d) + 0.153809*sind(2*d)...
+0.060783*cosd(2*d);
% Solar Angle
h = 15 .* (T - M) - L;
SEA = asind( sind(phi)*sind(D) + cosd(phi)*cosd(D)*cosd(h) );

3 Kommentare

Avee Patel
Avee Patel am 5 Nov. 2018
I have to find a solar elevation angle and plot of solar elevation as a function of time of day from sunrise to sunset based on date and location.
per isakson
per isakson am 5 Nov. 2018
Search File Exchange for solar elevation. You'll find a number of relevant submissions.
per isakson
per isakson am 5 Nov. 2018
I replaced this text, "where i am using h...where i am using h = 15 .* (t-m) - l it says matrix dimension must agree", in the Tags box by solar and elevation

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Gravitation, Cosmology & Astrophysics finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018b

Gefragt:

am 5 Nov. 2018

Kommentiert:

am 5 Nov. 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by