[Date Prev][Date Next][Thread Prev][Thread Next] - [Date Index][Thread Index][Author Index]

Re: Formula Wanted

On Sun, 01 Nov 1998 14:46:38 -0500 Ron Parise <parise@gelato.gsfc.nasa.gov> wrote:

> At 11:39 11/03/98 -0500, Jerald R. Malin wrote:
> >Does anybody have the formula that will calculate the course you must
> >fly and your ground speed if you know your true course, true air speed,
> >wind direction and wind speed?
> (reply)
> I don't know of any way to do an iterative solution to this problem
> in a spreadsheet, but then again I don't know much about spreadsheets.
> Good Luck!
> Ron, wa4sir

I don't know much about vector mathematics or aeronautics, but I know
a lot about spreadsheets.  With a tiny bit of dibbling around with the Help
screens, and maybe a beginner's book on VisualBasic, one can learn enough
macro-language to build a short macro in Excel (or the spreadsheet of
your choice as long as it allows "IF" branches) which can do iterations.
This should be covered in about the first or second chapter in VisualBasic
programming books.

You first put your desired heading in one cell, then the parameters which
are used by your heading calculation formula in another set of cells.
Next, you program the simplistic heading-calculation formula into still another
cell.  Of course, the first time around,  as Ron points out, the calculated heading
will not equal the desired heading, because your calculated formula was
based on a guess of what the correct parameters might be.

So next, you program (and then run) a macro which would compare the calculated heading 
with the desired heading and if the two were within an xxx tolerance then the 
macro branches out to a QUIT statement.  Otherwise, the macro increments the
parameters (the input cells used by the calculation formula) by a tiny
amount (causing the spreadsheet to automatically calculate a new
calculated heading), and the macro loops back to the beginning and
compares the new calculated heading with the desired heading and the macro
repeats this loop until the two are within the tolerance you specified.

You cannot "record" an IF statement in a macro language (for those of you
who know what "recording" a macro means).  Thus, you need to learn some
rudimentary macro-language programming.  But my wife is teaching
seventh-graders how to do IF statements in Visual Basic macros using
Excel97, and I require it in my accounting systems class. Of course,
my students' formulas yield stuff like depreciation and tax liabilities instead
of course headings, but the actual macro programs should behave the same.
It shouldn't take more than an hour or two to learn enough VisualBasic
to do a simple IF statement compare and branch.

Incidently, this is the way my dad used to calculate satellite plots
on the business-oriented mainframe computer back in the early 1960's before
we had commercial satellite tracking software.  COBOL does nifty
IF statements and loops, and the programs were ultrasimple, ... about
ten lines of code was all.  That was way back in the good ol' days
when the Smithsonian Institute used to mail out those tiny-print,
onion-skin computer printouts of who-knows-what kind of elements that
nobody uses anymore --- a whole page of numbers for one week's passes,
that still didn't tell you anything unless you did some awful
calculations with polar coordinate graph paper and a slide rule!  Ah, me,
those were the days!  But they sure predicted when the Echo balloon 
satellites would go by.  And remember Pageos?  The one in retrograde
orbit?  This was probably before most of today's satellite operators were 
born! ...   "Hey, Dave, what the heck is a COBOL?"

Good luck, Jerald.

By the way, Ron, you might want to check the date and time settings
on your mail server (...or maybe it's your client that time-stamps your
mail).  According to your email timestamp, you replied to Jerald
about two days before he asked his question.     :)

David R. Fordham
CPA, CMA, Ph.D.,
James Madison University
School of Accounting ZSH 334
Harrisonburg, VA 22807
E-mail:  fordhadr@jmu.edu
Homepage:  http://cob.jmu.edu/fordhadr/
Voice:  540-568-3024
Fax:    540-568-3017

Check out the Massanutten Amateur Radio Association
home pages:  http://cob.jmu.edu/fordhadr/MARA/

Via the amsat-bb mailing list at AMSAT.ORG courtesy of AMSAT-NA.
To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org