curve-fitting

Any (free) tools to compute Taylor series expansion of a function?

After painful trial and error, I arrived at a grotesque function that behaves the way I want it to: (exp(- abs(6 * (x - 0.7)) ^ 2.5 ) + exp(- (x-1.7) ^ 8 ) * 1.2)/1.5785 I only care about the values for the range 0 <= x <= 1 and the slope at x = 1. In this interval, 0 <= y <= 1 as well. Are there any free tools (web-based or MAC OS X...

Curve fitting in R using nls

I'm trying to fit a curve over (the tail of) the following data: [1] 1 1 1 1 1 1 2 1 2 2 3 2 1 1 4 3 2 11 6 2 16 7 17 36 [25] 27 39 41 33 42 66 92 138 189 249 665 224 309 247 641 777 671 532 749 506 315 292 281 130 [49] 137 91 40 27 34 19 1 I'm using the following function in...

Fitting a line in 3D

Are there any algorithms that will return the equation of a straight line from a set of 3D data points? I can find plenty of sources which will give the equation of a line from 2D data sets, but none in 3D. Thanks. ...

How do I implement such an invertible mapping(one-to-one) for curves using MATLAB?

So that several curves X,Y can be mapped to another curve R,which is invertible so that I can still get X,Y from R. Anyone has ideas for this or perhaps some term I can google it myself? UPDATE I think some clarifications are deserved here. map(X,Y) => R; invertible_map(R) => (X,Y) ...

Curve fitting: Find the smoothest function that satisfies a list of constraints.

Consider the set of non-decreasing surjective (onto) functions from (-inf,inf) to [0,1]. (Typical CDFs satisfy this property.) In other words, for any real number x, 0 <= f(x) <= 1. The logistic function is perhaps the most well-known example. We are now given some constraints in the form of a list of x-values and for each x-value, a pa...

Kink detection in drawn polylines

Users can sketch in my app using a very simple tool (move mouse while holding LMB). This results in a series of mousemove events and I record the cursor location at each event. The resulting polyline curve tends to be rather dense, with recorded points almost every other pixel. I'd like to smooth this pixelated polyline, but I don't want...

Curve-fitting in PHP

Hi, I have a MySql table called today_stats. It has got Id, date and clicks. I'm trying to create a script to get the values and try to predict the next 7 days clicks. How I can predict it in PHP? ...

How can I calculate a trend line in PHP?

So I've read the two related questions for calculating a trend line for a graph, but I'm still lost. I have an array of xy coordinates, and I want to come up with another array of xy coordinates (can be fewer coordinates) that represent a logarithmic trend line using PHP. I'm passing these arrays to javascript to plot graphs on the...

Finding the Formula for a Curve

Is there a program that will take "response curve" values from me, and provide a formula that approximates the response curve? It would be cool if such a program would take a numeric "percent correct" (perhaps with a standard deviation) so that it returns simplified formulas when laxity is permissable, and more precise (viz. complex) ...

R : catching errors in `nls`

I'm fitting some exponential data using nls. The code I'm using is: fit <- nls(y ~ expFit(times, A, tau, C), start = c(A=100, tau=-3, C=0)) expFit is defined as expFit <- function(t, A, tau, C) { expFit <- A*(exp(-t/tau))+C } This works well for most of my data, for which the starting parameters provided (100, -3 and ...

fitting two dimensional curves in matlab

There's a toolbox function for the curve fitting toolbox called cftool that lets you fit curves to 1-d data. Is there anything for 2-d data? ...

Fitting 2D data in Matlab

How would you fit a 2d curve such as ln(x^2) + 3y to an mxn array? Update I mean I have mxn array and want fit it with a 2D curve. Sorry for confusion. ...

java peak fitting library

Does anyone know of any peakfitting libraries for Java? I want to give it an array of data, and it tell me the position of the peak. eg for this data: x, y -5, 0.875333026 -4, 0.885868909 -3, 0.895851362 -2, 0.903971085 -1, 0.908274124 0, 0.907117054 1, 0.901894046 2, 0.894918547 3, 0.887651936 4, 0.880114302 5, 0.872150014 it will s...

Stretching out an array

I've got a vector of samples that form a curve. Let's imagine there are 1000 points in it. If I want to stretch it to fill 1500 points, what is the simplest algorithm that gives decent results? I'm looking for something that is just a few lines of C/C++. I'll always want to increase the size of the vector, and the new vector can be a...

How to do exponential and logarithmic curve fitting in Python? I found only polynomial fitting.

Hi, I have a set of data and I want to compare which line describes it the best (polynomes of different orders, exponential or logarithmic). I use Python and Numpy and for polynomial fitting there is a function polyfit(). But I found no such functions for exponential and logarithmic fitting. Are there any? Or how to solve it otherwise...

How to fit a smooth curve to my data in R?

I'm trying to draw a smooth curve in R. I have the following simple toy data: > x [1] 1 2 3 4 5 6 7 8 9 10 > y [1] 2 4 6 8 7 12 14 16 18 20 Now when I plot it with a standard command it looks bumpy and edgy, of course: plot(x,y, type='l', lwd=2, col='red') How can I make the curve smooth so that the 3 edges are r...

Power function fit

Hi. I want to fit a power function to a dataset. I'm using this method: http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html But the result is not acceptable: b = -0,001901, a = 7,26 My dataset: 8553600 458.2 17193600 373.6 25833600 694.16 34646400 738.33 44064000 817.89 54259200 1040.67 67910400 1032.69 762...

Fitting polynomial model to data in R

I've read the answers to this question and they are quite helpful, but I need help particularly in R. I have an example data set in R as follows: x <- c(32,64,96,118,126,144,152.5,158) y <- c(99.5,104.8,108.5,100,86,64,35.3,15) I want to fit a model to these data so that y = f(x). I want it to be a 3rd order polynomial model. How...

In Java, does an implementation exist for interpolating non-uniformly distributed time series data?

I have some matlab code which requires time series data that is uniformly distributed in time to produce an answer. The driver matlab code which reads the data file also runs an interp1( x, y, xi, 'cubic') on the data after it reads the file because the data is not uniformly distributed in time. Now I have to port this process to Java ...

Scipy optimize.curve_fit sometimes won't converge

Hi, I'm trying to use numpy.optimize.curve_fit to estimate the frequency and phase of an on/off sequence. This is the code I'm using: from numpy import * from scipy import optimize row = array([0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0...