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 个评论

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.
Search File Exchange for solar elevation. You'll find a number of relevant submissions.
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

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Solar Power 的更多信息

产品

版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by