Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Curve fitting

Options
  • 16-12-2011 7:21pm
    #1
    Registered Users Posts: 8


    I was wondering, what is a good (cheap) piece of software that is useful for curve fitting? When I look it up, Matlab seems to come up quite a lot. Prism (V.5) is the only programme I currently have access to that performs this function as far as I know. I see there's also an addon you can get for Excel (XLift).

    Incidentally, I would also like to know what the most accurate method for fitting a curve by hand would be. Just for example's sake, I'll make up some x,y co-ordinates.

    (20,100)
    (40,250)
    (60, 580)
    (80, 1000)
    (100, 2000)

    Can you work out an an accurate formula for the curve based on this data?


Comments

  • Registered Users Posts: 534 ✭✭✭PaulieBoy


    Biruni wrote: »
    I was wondering, what is a good (cheap) piece of software that is useful for curve fitting? When I look it up, Matlab seems to come up quite a lot. Prism (V.5) is the only programme I currently have access to that performs this function as far as I know. I see there's also an addon you can get for Excel (XLift).

    Incidentally, I would also like to know what the most accurate method for fitting a curve by hand would be. Just for example's sake, I'll make up some x,y co-ordinates.

    (20,100)
    (40,250)
    (60, 580)
    (80, 1000)
    (100, 2000)

    Can you work out an an accurate formula for the curve based on this data?
    I would think cubic splines would help ya there, at least I think they would!


  • Registered Users Posts: 12,967 ✭✭✭✭bnt


    I find Excel handy for quick curve fitting: plot the data, right-click on the plot line, and say "Add Trend". You can choose from different curve type, and you have options to display the formula and a R² goodness of fit. The closer R² is to 1, the better the fit.

    Alternatively, you could get Octave, which is a MATLAB clone, here. I just tried the following, using the "polyfit" function:
    x = 20:20:100
    y = [100, 250, 580, 1000, 2000]
    
    order = 1  
    # 1st order curve (linear)
    
    P = polyfit(x, y, order);
    #P is an array with the polynomial factors
    
    # calculate fitted curve for each X point
    f = P(1)*x + P(2)
    
    # plot the data - sample data vs fitted data
    plot(x, y)
    hold on 
    plot(x, f)
    hold off
    

    From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, ‘Look at that, you son of a bitch’.

    — Edgar Mitchell, Apollo 14 Astronaut



Advertisement