curve-fitting

gnuplot: Plot and fit 2d function with two variables

前提是你 提交于 2019-12-12 16:43:42
问题 Is its possible in gnuplot to plot and fit a function that has two variables? For example, a physical function that depends on hight h and Temperature T where the T dependence should only be calculated but not plotted (for f , h and T experimental data exists): f(h,T) = a * h * (1 + alpha * T) + f0 where a and f0 are to be determined by the fit, alpha is known. In the end I need a plot with f on the y-axis and h on the x-axis. The whole T dependence should be taken care of in the fit, but I

Output of MATLAB Curve Fitting Toolbox does not match generated function

折月煮酒 提交于 2019-12-12 16:05:56
问题 A similar question has been answered in the past, but my part of their question was not answered (Matlab curve fitting tool, cftool, generate code function does not give the same fit). I have a set of data points that are meant to show the "ideal" curve for the mechanism I am studying. When I ask the Curve Fitting Toolbox in Matlab to find a 2-term exponential, I get a great fit (R-square: 0.9998, Adjusted R-square: 0.9997). However, when I generate code for this fit, it changes the

scipy curve_fit cannot fit a tophat function

核能气质少年 提交于 2019-12-12 13:29:54
问题 I am trying to fit a top hat function to some data, ie. f(x) is constant for the entire real line, except for one segment of finite length which is equal to another constant. My parameters are the two constants of the tophat function, the midpoint, and the width and I'm trying to use scipy.optimize.curve_fit to get all of these. Unfortunately, curve_fit is having trouble obtaining the width of the hat. No matter what I do, it refuses to test any value of the width other than the one I start

Fitting a gauss curve to a certain histogram peak in c++

早过忘川 提交于 2019-12-12 12:09:30
问题 I have two questions concerning fitting a gauss curve to histogram peaks. My first question is a very basic one: How can I fit a gauss curve to a entire histogram? Does this only mean that I have to find out and calculate the mean value(µ) and the deviation(ϭ) of the histogram and put them into the formula for the Gauss curve? Would the following example be right?: Assume (just as an example) I have a histogram of an image with 5 colour values. On the X-Axes there are these 5 color values and

Why isn't `curve_fit` able to estimate the covariance of the parameter if the parameter fits exactly?

和自甴很熟 提交于 2019-12-12 08:21:42
问题 I don't understand curve_fit isn't able to estimate the covariance of the parameter, thus raising the OptimizeWarning below. The following MCVE explains my problem: MCVE python snippet from scipy.optimize import curve_fit func = lambda x, a: a * x popt, pcov = curve_fit(f = func, xdata = [1], ydata = [1]) print(popt, pcov) Output \python-3.4.4\lib\site-packages\scipy\optimize\minpack.py:715: OptimizeWarning: Covariance of the parameters could not be estimated category=OptimizeWarning) [ 1.] [

Fit Arbitrary Curve to Data Points in Matlab

爷,独闯天下 提交于 2019-12-12 06:24:16
问题 I would like to fit a curve on the form y=a+b*sin(2*pi*x)+c*cos(2*pi*x) to some data points in Matlab. I've been trying to use 'fit' but then I only get this message 'if isa( fittypeobj, 'fittype' )' This is my code: L = load('file.mat'); x = filedata(:,1); ft = fittype('a+b*sin(2*pi*x)+c*cos(2*pi*x)'); fit(x, filedata(:,3), ft) Can somebody please tell me what I'm doing wrong? 回答1: Here is how to do the fit 'by hand' in a least-squares way: x = x(:); %make sure we have column vectors y = y(:

Python gaussian fit on simulated gaussian noisy data

不打扰是莪最后的温柔 提交于 2019-12-12 05:40:09
问题 I need to interpolate data coming from an instrument using a gaussian fit. To this end I thought about using the curve_fit function from scipy . Since I'd like to test this functionality on fake data before trying it on the instrument I wrote the following code to generate noisy gaussian data and to fit it: from scipy.optimize import curve_fit import numpy import pylab # Create a gaussian function def gaussian(x, a, b, c): val = a * numpy.exp(-(x - b)**2 / (2*c**2)) return val # Generate fake

How to find coefficients for a possible exponential approximation

爷,独闯天下 提交于 2019-12-12 05:39:05
问题 I have data like this: y = [0.001 0.0042222222 0.0074444444 0.0106666667 0.0138888889 0.0171111111 0.0203333333 0.0235555556 0.0267777778 0.03] and x = [3.52E-06 9.72E-05 0.0002822918 0.0004929136 0.0006759156 0.0008199029 0.0009092797 0.0009458332 0.0009749509 0.0009892005] and I want y to be a function of x with y = a(0.01 − b*n^−cx). What is the best and easiest computational approach to find the best combination of the coefficients a , b and c that fit to the data? Can I use Octave? 回答1:

How to guess the actual lorentzian function without relaxation behavior with Least square curve fitting

守給你的承諾、 提交于 2019-12-12 05:26:58
问题 I wanted to ask you if it would be possible to implement this idea: So all in all, I measure a signal (blue curve, See plot of the measured data and the initial guess for the lorentzian function), this signal is a convolution of a lorentzian function and a certain relaxation kernel. I have an initial guess of the lorentzian function (see green curve), but as you notice, the green curve is not really aperfect lorentzian function , as it is still dissymmetric in the bottom. I have never used

Trouble with curve fitting - matplotlib

血红的双手。 提交于 2019-12-12 04:13:12
问题 I am trying to plot a sin function to a data set. I found a tutorial online using scipy.optimize, but it seems not to work even though I copied the code exactly. At the top: def func(x, a, b, c, d): return a * np.sin(b * (x + c)) + d At the end: scipy.optimize.curve_fit(func, clean_time, clean_rate) pylab.show() There is no line on the output window. If anyone would like screencaps or the whole code, feel free to comment below. Thanks! 回答1: of course it does not plot anything, curve_fit does