Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Social Media Script 1.0
ByteScout PDF Renderer SDK 9.0.0.3079
Magento Mobile App Builder 2.0.0
Binary MLM Plan 1.0.2
Review Assistant 4.0
SSIS Data Flow Components 1.8
Maulik Shah 1.0
GetOrgChart 2.4.91
ODBC Driver for SQL Azure 2.4
EntityDAC 2.0
CarMax Clone Script 1.0
Mega Menu Magento 2 2.0
Luxand FaceSDK 6.5.1
Data Puppy Lite (64-bit) 1.0
Bytescout BarCode Reader SDK 10.1.0.1778
Top Code
Bopup IM Client SDK 1.0.0
Library Management System 1.0
Readymade Wedding Directory Script 1.0.2
Open Source Practice Management Project 1.0
Event Ticketing System by PHPJabbers 1.0
Notebook Mini 1.0
FLAM Player for Music and Sound 1.56
Visual Python IDE 1.0
Chess Master 1.0
Calorie Calculator -
Stani's Python Editor 1.0
PHPtravels 1.1
ABPollMaster 1.I
Graphical Sorting Program Script 1.1
HTMLPad 2007 Pro 8.3
Top Rated
Output Messenger 1.8.0
Aliexpress Clone- Ec21 Script 1
Indiegogo Clone 3.0
Online Food Ordeing System 1.0
PHP Image Resize Script 1.0
Best Spotify Clone 1.0
Get Random Record Based on Weight 1.0.0
Travel Portal Script 9.29
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.4
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
sun_position.m 1.0
File ID: 80588






sun_position.m 1.0
Download sun_position.m 1.0http://www.mathworks.comReport Error Link
License: Freeware
File Size: 1.3 MB
Downloads: 162
Submit Rating:
sun_position.m 1.0 Description
Description: sun = sun_position(time, location)

This function computes the sun position (zenith and azimuth angle at the observer location) as a function of the observer local time and position.

It is an implementation of the algorithm presented by Reda et Andreas in:
Reda, I., Andreas, A. (2003) Solar position algorithm for solar radiation application. National Renewable Energy Laboratory (NREL) Technical report NREL/TP-560-34302, Revised January 2008.

This document is avalaible at http://rredc.nrel.gov/solar/codesandalgorithms/spa/ and is included in the .zip file

This algorithm is based on numerical approximation of the exact equations. The authors of the original paper state that this algorithm should be precise at +/- 0.0003 degrees. I have compared it to NOAA solar table (http://www.srrb.noaa.gov/highlights/sunrise/azel.html) and to USNO solar table (http://aa.usno.navy.mil/data/docs/AltAz.html) and found very good correspondance (up to the precision of those tables), except for large zenith angle, where the refraction by the atmosphere is significant (difference of about 1 degree). Note that in this code the correction for refraction in the atmosphere has been implemented for a temperature of 10C (283 kelvins) and a pressure of 1010 mbar. See the subfunction dlTzsun_topocentric_zenith_angle_calculationdlT¬ for possible modification to explicitely model the effects of temperature and pressure as describe in Reda & Andreas (2003).

Input parameters:
time: a structure that specify the time when the sun position is calculated.
time.year: year. Valid for [-2000, 6000]
time.month: month [1-12]
time.day: calendar day [1-31]
time.hour: local hour [0-23]
time.min: minute [0-59]
time.sec: second [0-59]
time.UTC: offset hour from UTC. Local time = Greenwich time + time.UTC
This input can also be passed using the Matlab time format ('dd-mmm-yyyy HH:MM:SS'). In that case, the time has to be specified as UTC time (time.UTC = 0)

location: a structure that specify the location of the observer
location.latitude: latitude (in degrees, north of equator is positive)
location.longitude: longitude (in degrees, positive for east of Greenwich) location.altitude: altitude above mean sea level (in meters)

Output parameters
sun: a structure with the calculated sun position
sun.zenith = zenith angle in degrees (angle from the vertical)
sun.azimuth = azimuth angle in degrees, eastward from the north.

Only the sun zenith and azimuth angles are returned as output, but a lot of other parameters are calculated that could also be extracted as output of this function. See the documentation in the code.

Exemple of use

location.longitude = -105.1786;
location.latitude = 39.742476;
location.altitude = 1830.14;
time.year = 2003;
time.month = 10;
time.day = 17;
time.hour = 12;
time.min = 30;
time.sec = 30;
time.UTC = -7;

sun = sun_position(time, location);

sun =

zenith: 50.1080438859849
azimuth: 194.341174010338

License: Freeware

Related: offset, Local, greenwich, timeutc, timemin, Minute, timesec, Input, passed, hhmmss, locationlatitude, ddmmmyyyy, Format, matlab, timehour, Calendar, Effects

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 1.3 MB

Downloads: 162



More Similar Code

Using this script, you can generate a set of data regarding Sun Azimuth Positions at various instants of time for any location on Earth. This data can be used in many applications, like, in determination of orientation of any plane's azimuth from True North.

The syntax is 'sun_azimuth_data' (no arguments). It prompts for Observer's geodetic coordinates, observer's time zone and starting time [according to local standard time]. Then,...



Teaser Block is a yet simple module which allows to create blocks that contain a link to a specified node.

Notes

* Teaser block is quite similar to Node as block, however, it uses the regular block configuration pages to...



javascript callback handler is an interim solution for high-performance server requests including (but not limited to) AHAH, AJAX, JSON, XML, etc.

Note that this module does nothing on itself, only install it if another module leverages...



This module allows you to take snapshots of your site. It turns a Drupal installation into a sandbox that you can use either for testing modules or setting up a public demonstration site for a module / extension / theme (you name it). Whenever you...



This tool is useful when one wants to create a GUI from a standalone M-file, but would like to use guide for it's excellent ability to position the GUI objects within the GUI. guidegetter works by first fetching the layout of the uicontrols,...



A command-line peak fitting program for time-series signals, written as a self-contained Matlab function in a single m-file. Uses an non-linear optimization algorithm to decompose a complex, overlapping-peak signal into its component parts. The...



This code determines the mean first passage time (MFPT) of an Ornstein-Uhlenbeck process from analytical solutions obtained from M.U. Thomas (1975), S. Sato (1977), and S. Sato & M. Ricciardi (1988) (all articles published in J. Appl....



This model simulates the position control of a DC motor. Parameters can be changed from the model properties tag.



moonpos calculates the moon position using the method in the book
Astronomical Algorithms by Jean Meeus, Chapter 45, pp 307 - 313. The
algorithm used is accurate to about 10 arcsec in longitude and 4 arcsec
in latitude according to...



Bidimensional surface shift to a position specified by a vector [x,y].

User Review for sun_position.m
- required fields
     

Please enter text on the image