![]() |
|
|||||
|
||||||
From: Mike Hannibal (no email)
Date: Sat Sep 10 2005 - 20:31:46 EDT
George's request prompted me to go looking as well. As
I said in a previous post SciLab
(http://www.scilab.org/) looked good.
Yesterday, seeking to explain to my children the "land
of the midnight sun" I cooked up a simple SciLab
script which I offer below with the usual caveats. I
note that we will soon be able to post files so that
will make this easier. If you plan to use this you may
have to sort out email induced carriage returns in the
lines.
You will note that I'm not a programmer but that I
created this with no knowledge of SciLab in a couple
of hours using the provided help file and the provided
editor.
Thanks for the impetus George.
Regards
Mike
Start Listing
##################
//Simple SciLab script to draw the altitude of the
sun;
//For given Latitude of observer;
//Over varying declinations of the sun;
//Mike Hannibal September 11 2005;
//Define the function FindAlt including the variables;
function Hc=FindAlt(L,d,HA),
Hc=asin((sin(L)*sin(d))+(cos(L)*cos(d)*cos(HA))),endfunction;
//Ask for input in the SciLab window;
L=evstr(input("enter Lat in whole degrees","s"));
//Create a radians converter;
r=%pi*2/360;
//Set up an HA vector in 10 degree steps;
HA=0:+10:360;
//Clear the graphics page;
clf();
//Put in a heading including the Latitude entered;
xtitle(['Altitude of Sun';'at Dec -23 to
+23';string(L);' degrees Latitude'],'LHA','Altitude');
//Get the graphics settings;
o=gda();
//Start a loop that goes from 23S to 23N declination
in 11.5 degree steps;
for d=-23:+11.5:23;
//Convert data to radians;
L=L*r;
d=d*r;
HA=HA*r;
//Call the function and convert back to degrees and
put it in z convert others back to degrees;
z=(FindAlt(L,d,HA))/r;
HA=HA/r;
L=L/r;
//Set the right graphics window and plot;
scf(0);
plot(HA,z,L);
//Make one of the graph axes visible and set it at the
zero mark;
o.axes_visible = ["on","off","off"];
o.x_location="middle";
//End the loop;
end;
#################
End Listing
--- george huxtable <> wrote:
> I asked-
>
> >Some recent postings on Nav-l have included
> listings of programs. This has
=== message truncated ===
Send instant messages to your online friends http://au.messenger.yahoo.com
|