?
Solved

how can i make plot values with this function

Posted on 2003-02-23
43
Medium Priority
?
264 Views
Last Modified: 2008-02-26
ok, not sure where to start with this!
i am making a prog which will produce an oval of aurora activity, the example below will produce an equatorward oval (the outside of the oval) once i have worked out how to do this, the poleward(inside) oval should be easy enough to achieve
i have phi which is 0 to 360 degrees
i have theta which co latitude, or -90 latitude
i am also using cos, but if im correct, flash uses radians, i need it to be in degrees.

i will be having what are known as Q coefficients going into my equation, these represent angles, they are numbered a1-a7, there are 6 sets,Q1-Q6

this is the equation i have so far, the syntax is right, i just dont know how to produce 360 plot values

function plotValues() {
(theta)-90degrees = a1 + a2 * cos(phi + a3)
+ a4 * cos((2 * phi) + (2 * a5))
+ a6 * cos((3 * phi) + (3 * a7));

an example of it working would be:
when phi=10
and Q=1
a1= 15.22,a2=2.70,a3=3.32,a4=-0.67,a5=1.15,a6=0.49,a7=1.00

90- 15.22 + 2.70 cos(10 + 3.32)
+ -0.67 cos(2*10 + 2*1.15)
+ 0.49 cos(3*10 + 3* 1.00)
which will equal 72.36 degrees, 360 plot values should give me an oval shape

i know i make a for loop for phi
so for (var phi=0;phi<360;phi++)
not sure where to go from here though

i have a fla file for someone whos not sure whats going on
0
Comment
Question by:pearcedn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 22
  • 21
43 Comments
 
LVL 6

Expert Comment

by:henryww
ID: 8007958
hi pearcedn,

isn't this the one we did back then ...
so u have figure out more about the ovals?

send us the fla or give us the fla then we can try to help.
so what happened to the last question. no help?

cheers
0
 

Author Comment

by:pearcedn
ID: 8008165
hi henry:)
yes its part of it, i understand a bit more now, i will send u the fla, is your hotmail address ok, cos its quite big, it might make a bit more sense now when u test it
0
 
LVL 6

Expert Comment

by:henryww
ID: 8008196
ok ... will check it out for u.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pearcedn
ID: 8008218
another late night henry?
0
 

Author Comment

by:pearcedn
ID: 8008224
Message from  yahoo.com.
Unable to deliver message to the following address(es).

<henryww@hotmail.com>:
65.54.253.230 failed after I sent the message.
Remote host said: 552 Requested action not taken: exceeded size limit
0
 
LVL 6

Expert Comment

by:henryww
ID: 8008247
oops ... sorry ...
can u try henryww@yahoo.com then ... more space there.
cheers
0
 
LVL 6

Expert Comment

by:henryww
ID: 8008264
hmmm .. .not so late yet ... unless ur question is impossible to solve ... he he he ...

it is 9:17pm here ... actually going to have dinner soon...
0
 
LVL 6

Expert Comment

by:henryww
ID: 8008279
hmmm .. .not so late yet ... unless ur question is impossible to solve ... he he he ...

it is 9:17pm here ... actually going to have dinner soon...
0
 

Author Comment

by:pearcedn
ID: 8008432
sorry henry, sent u the older one, new one sent
0
 

Author Comment

by:pearcedn
ID: 8008754
ok, i have both poleward and equatorward coefficients showing now. now i need the equation above working and im cooking on gas!!!
0
 

Author Comment

by:pearcedn
ID: 8009521
what do you reckon? do-able?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8010024
ok. bit complicated ... working on it ...
give me sometime to analysis the problem.

cheers
0
 

Author Comment

by:pearcedn
ID: 8010047
ok, no problem, gonna make dinner now, would u like me to send u the updated fla?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8010383
sure... if u have it :)
0
 

Author Comment

by:pearcedn
ID: 8010500
ok, on its way
0
 
LVL 6

Expert Comment

by:henryww
ID: 8010756
WOW ...

//at 12fps, 1 rotation = 30secs, 86400 sec1day/30
onClipEvent(enterFrame){
     this._rotation -= .000347222;
}

 is that what u added?

this is going to use a lot of processor time, my computer almost stopped!! not a super fast computer (p4-1.7g) but it takes up 99% of time in flash. i would suggest u modify the code a bit, if u really want to do a timed rotation, use setInterval of something to call a function and make the angel an integer will definitely help :O

... ... ...
0
 

Author Comment

by:pearcedn
ID: 8010885
i wondered why it was going so slow!
thanks for the advice
0
 
LVL 6

Expert Comment

by:henryww
ID: 8011015
i had tried very hard to understand the graph from
http://www.dan.sp-agency.ca/www/rtoval.htm
and guessing from the information u have given ...
is that some kind of a phD thesis or what?

looked here for more in depth explanation
http://www.ucl.ac.uk/~ucaptss/work/publications/thesis/chapter5/Magnetosphere.htm#Auroral%20polar%20cap%20region

well, how do i derive a formula to draw those ovals with 7 coefficients. can u give me more information and tell what actually this thing is for???

i assume u will at least know what u are doing and why are doing it. if not, well... go see a doctor. LOL ... a ha ha

can u find me some example or a link somewhere?
0
 

Author Comment

by:pearcedn
ID: 8011100
no this is my undergrad third yr project, fun huh!
i didnt even know what flash mx was 2 1/2 months ago, this is why im struggling so much

those 2 sets of 7 angle coefficients will go through the equation above, this will give me 2 sets of 360 plots, an outer and inner oval, i will worry about making it a pretty coloured oval later, at the mo im just trying to get the ovals to appear!

the project is to let the user see past auroral activity, thats what those long lines of data from the ftp site is. if u think thats bad, i have to do future predictions next!!!!!!
0
 
LVL 6

Expert Comment

by:henryww
ID: 8011200
bad? why?

no i just don't understand why someone will want to do this in flash ... u know, it's more like a C, VB, Fortran type of question and i don't have a clue how to deal with the 7 co... !!!

ok, i will try to help, but ... how?
let's say if u want to produce a plot ...
u can use moveTo, lineTo, curveTo etc to draws the lines

let's say u are given those values, what do u do with them normally? not in flash say just to do it on paper, how?

give me a lecture, and see if i can understand it.
0
 

Author Comment

by:pearcedn
ID: 8011242
i will email u some stuff i have, might help you understand:)
0
 
LVL 6

Expert Comment

by:henryww
ID: 8011252
consider that u have only learn flash for 2 1/2 month .. that's really something ... hmmm ..
honestly.

i learnt flash5 when i was told to make a ecard (game)2 yrs ago ... but then i had never used it b4 and 2 weeks i got the game done ... and that's something too ...  i guess.

well, that was about to lose my job as an IT manager or to impress my boss and have my pay check secured...

0
 
LVL 6

Expert Comment

by:henryww
ID: 8011299
ok... but bed time for me now :)
see what i can do later.

0
 

Author Comment

by:pearcedn
ID: 8011320
thanks, goodnight (or morning!)
0
 

Author Comment

by:pearcedn
ID: 8011348
if anyone else would like the fla file, im happy to send it out, its gotta be worth a grand to someone
0
 

Author Comment

by:pearcedn
ID: 8011368
oops its 500 max, sorry,
0
 
LVL 6

Expert Comment

by:henryww
ID: 8011455
... WOW ...
got the msgs on my email just b4 i hit my bed.

so do i get my last 500? and + this will be a grand ...

now who wants to be a millionaire?
... ha ha ha
0
 

Author Comment

by:pearcedn
ID: 8011516
if u can help me with this prob you can have 1500, didnt u get the 500 for the xml database thing?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8020093
ok ... now i have got some values out from the plotValue function, but it doesn't make any sense ...

the following is a truncated list of theta out from poleward, 2000, JAN, 1st - 0000-0300

15.1272145879588
0
15.1233347761941
0.0174532925199433
15.1219683621124
0.0349065850398866
15.1231187629165
0.0523598775598299
15.126783927972
0.0698131700797732
15.1329563402579
0.0872664625997165
15.141623031308
0.10471975511966
15.1527656096109
0.122173047639603
15.1663603024
... etc ...

i modified u code and pass the 7cos to get 360 pts for each set which should be enough to give a smooth oval with the plot ...

just as u said looping 0 to 360, convert to radian and pass phi to the Math functions, but when u are adding the coefficient, it that in degree??? do u have to convert that too??????
 

but ... look at the data produced? how?

so what is theta? u haven't explained, is theta used to pole the oval? in what form? polar form?

0
 
LVL 6

Expert Comment

by:henryww
ID: 8020111
i don't think u really understanding what u are doing ...  do u? ..... @_@!
0
 
LVL 6

Expert Comment

by:henryww
ID: 8020164
sorry ... my fault...
i didn't read ur qestions again...

ok .. let me try again and see if i can fix that ...
so u need every in degree right ...

hmmm ... let me get some sleep 1st then i will give it another go tomorrow, had a rough day today too ...

cheers
0
 
LVL 6

Expert Comment

by:henryww
ID: 8020187
hmmm 1 more thing ... so the center is the pole right ... center of the globe's rotation

0
 

Author Comment

by:pearcedn
ID: 8024136
my you have been a busy bee, yes the centre is the pole,
[code]
Math.cosD = function(d){
     return Math.cos(d*180/Math.PI)
}
[/code]
ive got this to convert from radians to degrees, any use?
0
 
LVL 6

Expert Comment

by:henryww
ID: 8024268
i have done that already ... radian to degree
just that i forgot  like this ...
cos(phi + a3)

phi is radian fine, but a3 (degree?) ... i forgot to turn it radian as well, but for theta the result should be the same regardless (radian or degree), cos it is not actually an angle right?

when u say ...

(theta)-90degrees = a1 + a2 * cos(phi + a3)
+ a4 * cos((2 * phi) + (2 * a5))
+ a6 * cos((3 * phi) + (3 * a7));

but the RHS of the equation doesn't give u an angle, u agree? or .... well let me work it out and see what it is like...
0
 

Author Comment

by:pearcedn
ID: 8024326
a1 to a7 are all angle coefficients
phi is 0 to 360 degrees
theta is co latitude, or -90 degree latitude, so i suppose your right, its not an angle just -90

i tried the equation on a calculator, put it in degrees first then did:
with phi as 10
using Q1

15.22 + 2.70 cos(10 + 3.32)
+ -0.67 cos(2*10 + 2*1.15)
+ 0.49 cos(3*10 + 3* 1.00) - 90 and got 72.36 degrees
i check it with my tutor, it was correct, so it does work
0
 
LVL 6

Expert Comment

by:henryww
ID: 8025765
damn ...

that's cool ... ha ha ha ...

well, time to brush up some of algebra & tri functions ... :)

i am still at work, will try again later when i got home

cheers
0
 
LVL 6

Expert Comment

by:henryww
ID: 8028047
those were interesting links but i don't know how they are connected in solving the mystery.

anyway, i have done more research on the top and it turns out that is far too complicated to get the geomagnetic coordinates, which i don't know how!!

i have to admit that i am a layman to this...

if i sub the values in the eq, i got the answer too. but if u can some how give me those points u want to plot, then i can help u with the plot.

again that's what i got for theta then what?
-71.6922661980866
-71.6967166155607
-71.7036794500863
-71.7131404284096
-71.7250798631296
-71.7394727004042
-71.7562885808779
-71.7754919136701
-71.7970419632351
-71.8208929488653
-71.8469941565804
-71.8752900631117
-71.9057204716586
-71.9382206590644
-71.9727215340291
-72.0091498059471
-72.0474281639318
-72.0874754655607
-72.1292069348522
-72.1725343689572
-72.2173663530325
-72.2636084827342
-72.311163593757
-72.3599319978233
-72.4098117245088
-72.4606987682814
-72.5124873401107
-72.5650701229999
.. .. etc

that's not something that u can just put straight on the map and plot ... what is missing??? do u know???

FYR: that's what i got from one of the site i looked at

 The mathematical representation of the auroral ovals
               is found by fitting Feldstein statistical ovals in
               corrected geomagnetic coordinates to a 7-parameter
               Fourier series:
     
          theta =  A1  +  A2 cos(phi + A3)
                +  A4 cos(2phi + 2A5)
                +  A6 cos(3phi + 3A7)

          theta = corrected geomagnetic co-lattitude
          phi = 2(pi)(MLT)/(24hrs)

               The best fit constants are found for each value of
               Q=0..6, where Q is the activity index which describes
               how quiet (0) or active (6) the Feldstein auroral
               ovals are.  The characteristic radius A1 of the ovals
               increases monotonically with Q.

               The **formula** in Holzworth and Meng gives the ovals in
               corrected geomagnetic coordinates.  The procedure
               transform_mag_geo.pro converts them to geograhic
               coordinates using the eccentric dipole model.


now where is THE FORMULA? and what formula?
turning theta into X-Y plan?? how??
0
 
LVL 6

Expert Comment

by:henryww
ID: 8028070
oh here's another link for u ...
if u can just tell me what happens when get the complete list...  then how to put it on a simple X-Y 2D plan?

http://www.phy6.org/Education/bh2_6.html
0
 
LVL 6

Accepted Solution

by:
henryww earned 2000 total points
ID: 8028139
i also tried to read the scanned pages u gave me ... i know it is trying to explain how to draw the circle, but it is a bit too hard for me to understand....

can u put that in plain english or a simple pseudo code for me ... ? i am just an ordinary IT manager...

cheers
0
 

Author Comment

by:pearcedn
ID: 8028289
i will see my tutor tomorrow as i have no idea, i have some paperwork which you may understand cos i dont, i will send it now
0
 

Author Comment

by:pearcedn
ID: 8029020
oops sorry about sending that again
i am on twelvestones forum, trying to get an answer now
0
 

Author Comment

by:pearcedn
ID: 8032867
This man is gracious as he is patient
very helpfull and a life saver!!!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question