4.0

4.0 | 3 ratings Rate this file 33 Downloads (last 30 days) File Size: 3.58 KB File ID: #23051
image thumbnail

Vectorized Solar Azimuth and Elevation Estimation

by

 

20 Feb 2009 (Updated )

Predict the topocentric solar position defined by geodetic lat, lon, Alt, and a universal time

| Watch this File

File Information
Description

Predict the azimuth and elevation of the Sun within +/- 1 degree at any geodetic latitude, longitude and altitude. Due to popular demand, this routine has been vectorized for speed.

Function Call: [Az El] = SolarAzEl('2008/02/18 13:10:00',60,15,0)

Input List:
UTC Date and Time - Use format YYYY/MM/DD hh:mm:ss or MATLAB date vector dimensions can be [N x 1]
Latitude - Site Latitude in degrees -90:90 -> S(-) N(+) dimensions can be [N x 1]
Longitude - Site Longitude in degrees -180:180 W(-) E(+) dimensions can be [N x 1]
Altitude - Site Altitude in km dimensions can be [N x 1]
 
Output List:
Az - Solar Azimuth angle in degrees [N x 1]
El - Solar Elevation/Altitude Angle in degrees [N x 1]

Acknowledgements

This file inspired Right Ascension/Declination To Azimuth/Elevation and Spot Solar Panel Orientation Toolbox.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
08 Apr 2013 Per

Very useful function. With a few updates it can handle vector time input. I would prefer the use of matlab UTC time input in order to speed up.

27 Aug 2009 Phil

Ropey when using vector times: (line 36 generates a vector eccentricity: line 42 then requires an edit to force array multiply not matrix multiply). Still unable to get vector time version to agree with loop version....
As Mr. Picky, I would prefer time argin to be Matlab datenum, not string.
HOWEVER, this is the only code I've found that gives Azimuth round the full 360: most are 0-180 and it's up to you to find if its in the east or west... due to using code like
http://en.wikipedia.org/wiki/Solar_azimuth_angle
Thanks

19 Mar 2009 Anthony Kendall

Excellent function, it's fast, compact, and easily modified for my particular needs. Thank you very much! BTW, I compared it with sun position tables, (http://www.srrb.noaa.gov/highlights/sunrise/azel.html) and it does very well.

Updates
18 Apr 2013

Vectorized routine. Added the ability to take either UTC time string, or an array of MATLAB date vectors.

Contact us