Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3628110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:58:27+00:00 2026-05-18T23:58:27+00:00

I have a chart in excel that represents some value over a one day

  • 0

I have a chart in excel that represents some value over a one day period. So I add the reference function and I get something like this:

y = 1E-13x6 - 2E-10x5 + 8E-08x4 - 1E-05x3 + 0,0004x2 + 0,0275x + 8,414

A mesure in my data set is:

09:36:21 => 5,27

The firts thing I need to know is how to transform the timestamp into a value to give to the function. After some cell value transforming I’ve found out that excel gives timestamps a representation between 0.00000 and 0.99999, so for example 09:36:21 is 0.400243055555556. Then I’ve coded a little java test script:

double x = 0.400243055555556;
double x6 = (1*Math.pow(10, -13))*Math.pow(x, 6);
double x5 = (2*Math.pow(10, -10))*Math.pow(x, 5);
double x4 = (8*Math.pow(10, -8))*Math.pow(x, 4);
double x3 = (1*Math.pow(10, -5))*Math.pow(x, 3);
double x2 = (4*Math.pow(10, -4))*Math.pow(x, 2);
double y = x6 - x5 + x4 - x3 + x2 + 0.0275*x + 8.414;

But after executing this script I get y = 8.425070122712738. So this is obviously not working. I must say that all the values in the chart range from 5 to 12.

I’m obviously doing something wrong, but I don’t know what. Maybe I’ve coded the function badly, or maybe the x I’m choosing is not a right value, but something is wrong. Can anyone help?

Update: My code wasn’t that good, what duffymo suggested worked better. But the problem was that Excel was giving my the wrong tendendy line. I’ve managed to get the good one using a scatter graph.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:58:28+00:00Added an answer on May 18, 2026 at 11:58 pm

    I would not recommend coding it this way – roundoff could be an issue.

    I would recommend Horner scheme:

    I coded it this way and got the same answer that you did:

    public class Horner
    {
       public static final NumberFormat DEFAULT_FORMAT = new DecimalFormat("0.000");
    
       public static void main(String[] args)
       {
          double [] a = { 8.414, 0.0275, 0.0004, -1.0e-5, 8.0e-8, -2.0e-10, 1.0e-13 };
          for (double x = 0.0; x < 1.0;  x += 0.05)
          {
             double y = a[0] + x*(a[1] + x*(a[2] + x*(a[3] + x*(a[4] + x*(a[5])))));
             System.out.println("x = " + DEFAULT_FORMAT.format(x) + " y = " + DEFAULT_FORMAT.format(y));
          }
       }
    }
    

    Here’s the result I get. The higher order terms aren’t doing much good; the coefficients are small, and when you raise a fraction to a power it diminishes the effect even more.

    x = 0.000 y = 8.414
    x = 0.050 y = 8.415
    x = 0.100 y = 8.417
    x = 0.150 y = 8.418
    x = 0.200 y = 8.420
    x = 0.250 y = 8.421
    x = 0.300 y = 8.422
    x = 0.350 y = 8.424
    x = 0.400 y = 8.425
    x = 0.450 y = 8.426
    x = 0.500 y = 8.428
    x = 0.550 y = 8.429
    x = 0.600 y = 8.431
    x = 0.650 y = 8.432
    x = 0.700 y = 8.433
    x = 0.750 y = 8.435
    x = 0.800 y = 8.436
    x = 0.850 y = 8.438
    x = 0.900 y = 8.439
    x = 0.950 y = 8.440
    

    Still not what you want, but I think the coding is far simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that generates image of a pie chart. It's a general
I have a script that appends some rows to a table. One of the
I have an Excel document (2007) with a chart (Clustered Column) that gets its
I have a chart in a Worksheet in Excel and I have a macro
I have a chart with a series that denotes a large set (1000's) of
I have a chart (in bitmap format) that I'm trying to render to a
I have an Excel spreadsheet template with data and a chart. I want to
I have a list of 350 addresses in a single column excel file that
I have an excel document that queries an SQL Database on button press. The
I have a c# application that generates an Excel workbook. The problem is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.