# curve fitting

• ## How to set a "length" parameter in a weibull distribution. I'm trying to model a response curve of a direct mail marketing campaign over time2017-09-12

I'm trying to fit a curve to model responses from a direct mail campaign over time. Using R, I was a able to get a shape and scale factor using the fitdistr() function. Then I use the shape and scale as parameters in the weibull() function. However,

Tags: curve fitting, weibull
• ## how to fit baseline/background in R2016-02-18

I am trying to fit the background shape in nmr spectra. For this I have been using the loess function so far. First I try to identify all the peaks (which works more or less) and remove them from the spectrum. Then I try to fit the rest of the spectr

• ## Correct fitting with scipy curve_fit including errors in x?2014-09-26

I'm trying to fit a histogram with some data in it using scipy.optimize.curve_fit. If I want to add an error in y, I can simply do so by applying a weight to the fit. But how to apply the error in x (i. e. the error due to binning in case of histogra

Tags: python, numpy, scipy, curve fitting
• ## One strange way to generate b-spline base2014-09-19

I am trying to use curve fitting under Matlab. There are two kinds of spline in Matlab: piecewise polynomials and b-spline. For b-spline, we know that the basic functions can be derived by means of a recursion formula. You can see the below link: htt

Tags: matlab, spline, curve fitting
• ## How to detect spiral optical flow using matlab?2014-07-24

I have a video of a giant whirlpool, similar to the below image Can anyone give an algorithm / code to detect SPIRAL OPTICAL FLOW? Is it possible to fit a spiral curve over it depending on the spiral optical flow? If yes how? Thank you. -------------

• ## How to fit line in 3d space (not plane)2014-06-26

How do I perform a fit through the most dense regions of the z <- (x,y) presented on the plot attached? The thing is that i tried locfit(z~lp(x,y)) but instead of a line in 3d space I received a plane fit.

Tags: curve fitting
• ## Linear Fit python errors2014-06-11

I'm trying to fit some linear lines to curves, they behave linearly near 0 and then do odd things. But I need their behavior around zero. Now I've written a little script, and it does not work at all for some curves, while it does others perfectly. A

Tags: python, numpy, curve fitting
• ## Sine wave least squares curve fitting possible (using GSL)?2014-02-13

Is it possible to fit an A*sin(B*t+C) function with GSL or a similar library? i want to get the A and C parameter of a sine wave present in 4096 samples (8bit) and can provide an good approximation of B. A think that should be possible with GSLs non-

• ## how to code Multi threading a for loop curve fitting2013-10-24

I have a "for loop" that runs over 100 range values and for each value, I call scipy.optimize to do a non-linear curve fitting. When I run it on a 4-core desktop, I see the CPU utilization as 100% which is just 1 core fully used. I want to use multi

• ## Fitting an exponential approach/asymptotic power law in R/Python 2013-08-26

How can I fit my data to an asymptotic power law curve or an exponential approach curve in R or Python? My data essentially shows that the the y-axis increases continuously but the delta (increase) decreases with increase in x. Any help will be much

Tags: python, curve fitting
• ## Fitting data using UnivariateSpline in scipy python2013-07-28

I have a experimental data to which I am trying to fit a curve using UnivariateSpline function in scipy. The data looks like: x y 13 2.404070 12 1.588134 11 1.760112 10 1.771360 09 1.860087 08 1.955789 07 1.910408 06 1.655911 05 1.778952 04 2.624719

Tags: python, numpy, scipy, curve fitting
• ## Two dimensional least squares fitting2013-02-06

I have a two dimensional data set, of some fixed dimensions (xLen and yLen), which contains a sine curve. I've already determined the frequency of the sine curve, and I've generated my own sine data with the frequency using SineData = math.sin((2*mat

• ## Smooth line in QGraphicsScene with Qt2012-10-19

I need to draw curves with Qt: The user clicks on QGraphicsScene (via QGraphicsView) and straight lines are drawn between the points clicked on by the user. When the user finishes to draw straight lines (by clicking on the right button), the set of l

• ## Moving along a Catmull Rom spline2012-10-09

I'm trying to implement a way to visualize magnetic fields and after some googling I settled on using Catmull Rom Splines to create the curves necessary. One of the things I wanted to do however was have arrows move along the lines to indicate direct

Tags: curve fitting
• ## Fitting a waveform to a set of points and choosing discrete intervals from it2012-05-01

I have a data.frame of values with samples taken at intervals that were not exact hours. The samples form oscillating waves of unknown amplitude and period. I would like to estimate the value at every exact hour. hours value 60 63.06667 22657 61 64.0

• ## power curve fitting with 2 terms 2012-04-20

How can I fit this equation to a set of data (x,y) y = a x ^ b + c I tried least square error method and power low but it doesn't work! --------------Solutions------------- I solved it! Y = a x ^ b ; Y = y-c so 'a' and 'b' can be obtained from least

Tags: math, curve fitting
• ## trying to get reasonable values from scipy powerlaw fit2012-04-16

I'm trying to fit some data from a simulation code I've been running in order to figure out a power law dependence. When I plot a linear fit, the data does not fit very well. Here's the python script I'm using to fit the data: #!/usr/bin/env python f

• ## passing arguments to a function for fitting2012-04-15

I am trying to fit a function which takes as input 2 independent variables x,y and 3 parameters to be found a,b,c. This is my test code: import numpy as np from scipy.optimize import curve_fit def func(x,y, a, b, c): return a*np.exp(-b*(x+y)) + c y=

Tags: python, numpy, scipy, curve fitting
• ## Simultaneous fitting to N datasets in Python2012-04-13

I have a single function that I want to fit to a number of different datasets, all with the same number of points. For example, I might want to fit a polynomial to all rows of an image. Is there an efficient and vectorized way of doing this with scip

Tags: python, curve fitting
• ## How can I find equation of a plot connecting data points in Matlab?2012-03-30

I have various plots (with hold on) as show in the following figure: I would like to know how to find equations of these six curves in Matlab. Thanks. --------------Solutions------------- I found interactive fitting tool in Matlab simple and helpful,

Tags: matlab, curve, equation, curve fitting