Jump to content
Sign in to follow this  
Guest iagman

Formula for a curve

Recommended Posts

Guest iagman

Would someone help me determine the formular for a curve that plots to these values:If Miles = 0, then Offset = 5;If Miles = 10, then Offset = 500;If Miles = 20, then Offset =2000.I would like to have a formula that would calculate the Offset for any known value of Miles between 0 and 20 and would be xml friendly.Thanks,Glenn

Share this post


Link to post
Share on other sites

Hi,(Long tima ago??????????????????????)Looks like something as a parabole:y = ax2 + b Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

>Would someone help me determine the formular for a curve that>plots to these values:>If Miles = 0, then Offset = 5;>If Miles = 10, then Offset = 500;>If Miles = 20, then Offset =2000.>I would like to have a formula that would calculate the Offset>for any known value of Miles between 0 and 20 and would be xml>friendly.>Thanks,>Glenn>What you're wanting to do is called forecasting in statistics.It's not really complex... but it would be in XML. I don't do XML... but I do C... here's a C version... maybe you can translate it?FLOAT64 Offset_By_Miles(FLOAT64 miles_index){ FLOAT64 Miles[3] = {0,10,20}; FLOAT64 Offset[3] = {5,500,2000}; int i; FLOAT64 sx, sy, xmean, ymean, sxx, sxy, syy, x, y; FLOAT64 B0, B1; //{compute basic sums} sx = 0.0; sy = 0.0; sxx = 0.0; sxy = 0.0; syy = 0.0; for (i = 0; i < 3; i++) { x = Miles; y = Offset; sx = sx+x; sy = sy+y; sxx = sxx+x*x; syy = syy+y*y; sxy = sxy+x*y; } xmean = sx/(float)3; <<- number of items ymean = sy/(float)3; sxx = sxx-(float)3*xmean*xmean; syy = syy-(float)3*ymean*ymean; sxy = sxy-(float)3*xmean*ymean; //{check for zero variance} if (sxx <= 0.0) { // bad return 0; } B1 = sxy/sxx; B0 = ymean-B1*xmean; // forecast Y based on X; return B0+B1*miles_index; //2049.75}


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

Glenn,(miles) sp0l0 sqr 5.025 * l0 0.75 * - 5 + (>Offset)2nd order polinomial, R2=1Hope this helps.Tom

Share this post


Link to post
Share on other sites

Hi,Tom was first!Old dutch mathematics for parabole:y (offset) = ax2 + bx + cYour data 0-5; 10-500; 20-2000So c = 5and after some calc a = 5.025 and b = -0.75That gives y = 5.025 * Miles2 - 0.75 * miles + 5 in xml:(L:Miles,number) (L:Miles,number) * 5.025 * (L:Miles,number) 0.75 * - 5 + (>L:Offset,number) "Mustard after meal"Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

""and after some calc""Not too much calcs indeed, aprox. 30 secs to find the formula in Excel. :-)Tom

Share this post


Link to post
Share on other sites
Guest iagman

Great, thanks, guys. I'll put these to the test over the weekend.Glenn

Share this post


Link to post
Share on other sites

Yeah Tom got in before me, but if you plot curves in Excel it can tell you the formula, especially if it has a regular mathematical shape.cheers,nick

Share this post


Link to post
Share on other sites
Guest iagman

My daughter has been praising Excel for years. They gave me MS Office for Christmas because my old Word 97 was coughing up blood if graphics got a bit heavy. I've never run anything in the Office suite other than Word. I always thought Excel was just a spreadsheet for business applications such as taxes, etc. I'll definitely look into it now. Thanks for the tip.Glenn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...