curve-fitting

MATLAB Curve Fitting (Ellipse-like)

走远了吗. 提交于 2019-12-30 10:05:08
问题 I need to fit 10 data points ( x,y ) into this equation: ay² + bxy + cx + dy + e = x² It's told that this is a ellipse-like equation. I can't do it with usual curve fitting tools because it is not really a function (one x corresponds to 2 y s). I can't either use ellipse curve fitting because there is no c*x and d*y in an ellipse equation. Any ideas? Thanks in advance. EDIT: Both Oil and AK4749 gave right answer! Thank you guys! 回答1: It is a linear system with variables [a b c d e]. You can

How to compute standard error from ODR results?

巧了我就是萌 提交于 2019-12-30 08:23:10
问题 I use scipy.odr in order to make a fit with uncertainties on both x and y following this question Correct fitting with scipy curve_fit including errors in x? After the fit I would like to compute the uncertainties on the parameters. Thus I look at the square root of the diagonal elements of the covariance matrix. I get : >>> print(np.sqrt(np.diag(output.cov_beta))) [ 0.17516591 0.33020487 0.27856021] But in the Output there is also output.sd_beta which is, according to the doc on odr Standard

Errors to fit parameters of scipy.optimize

牧云@^-^@ 提交于 2019-12-30 05:11:14
问题 I use the scipy.optimize.minimize ( https://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html ) function with method='L-BFGS-B . An example of what it returns is here above: fun: 32.372210618549758 hess_inv: <6x6 LbfgsInvHessProduct with dtype=float64> jac: array([ -2.14583906e-04, 4.09272616e-04, -2.55795385e-05, 3.76587650e-05, 1.49213975e-04, -8.38440428e-05]) message: 'CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH' nfev: 420 nit: 51 status: 0 success: True x: array([ 0.75739412,

R : catching errors in `nls`

喜夏-厌秋 提交于 2019-12-30 03:26:08
问题 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 0) work well. Sometimes, though, I have data that doesn't go well with those parameters and I get errors from nls (e.g. "singular gradient" or things like that). How do I "catch

geom_smooth and exponential fits

血红的双手。 提交于 2019-12-29 07:43:06
问题 I am new to R and I'm having some difficulty plotting an exponential curve using ggplot2. I have a set of data below. DATA X Y x y 1 0.6168111 37.20637 0.6168111 37.20637 2 0.5478698 24.17084 0.5478698 24.17084 3 0.6082697 26.21261 0.6082697 26.21261 4 0.6094899 26.14065 0.6094899 26.14065 5 0.6095040 38.56314 0.6095040 38.56314 6 0.6933108 36.78443 0.6933108 36.78443 7 0.5796637 27.82840 0.5796637 27.82840 8 0.4716866 30.63080 0.4716866 30.63080 9 0.5291792 29.78255 0.5291792 29.78255 10 1

Finding a curve to match data

橙三吉。 提交于 2019-12-29 03:30:47
问题 I'm looking for a non-linear curve fitting routine (probably most likely to be found in R or Python, but I'm open to other languages) which would take x,y data and fit a curve to it. I should be able to specify as a string the type of expression I want to fit. Examples: "A+B*x+C*x*x" "(A+B*x+C*x*x)/(D*x+E*x*x)" "sin(A+B*x)*exp(C+D*x)+E+F*x" What I would get out of this is at least the values for the constants (A, B, C, etc.) And hopefully stats about the fitness of the match. There are

Equivalent of Matlab's 'fit' for Gaussian mixture models in R?

主宰稳场 提交于 2019-12-25 12:44:34
问题 I have some time series data that looks like this: x <- c(0.5833, 0.95041, 1.722, 3.1928, 3.941, 5.1202, 6.2125, 5.8828, 4.3406, 5.1353, 3.8468, 4.233, 5.8468, 6.1872, 6.1245, 7.6262, 8.6887, 7.7549, 6.9805, 4.3217, 3.0347, 2.4026, 1.9317, 1.7305, 1.665, 1.5655, 1.3758, 1.5472, 1.7839, 1.951, 1.864, 1.6638, 1.5624, 1.4922, 0.9406, 0.84512, 0.48423, 0.3919, 0.30773, 0.29264, 0.19015, 0.13312, 0.25226, 0.29403, 0.23901, 0.000213074755156413, 5.96565965097398e-05, 0.086874, 0.000926808687858284,

How to extend the line of 2 PolyFit from either side to intersect and get a combined fit line

99封情书 提交于 2019-12-25 08:34:41
问题 I am trying to get combined fit line made from two linear polyfit from either side (should intersect), here is the picture of fit lines: I am trying to make the two fit (blue) lines intersect and produce a combined fit line as shown in the picture below: Note that the crest can happen anywhere so I cannot assume to be in the center. Here is the code that creates the first plot: xdatPart1 = R; zdatPart1 = z; n = 3000; ln = length(R); [sX,In] = sort(R,1); sZ = z(In); xdatP1 = sX(1:n,1); zdatP1

Fitting Function with Multiple Files

ぐ巨炮叔叔 提交于 2019-12-25 06:42:30
问题 My Data: File 1: 2015-08-01 07:00 0.23 0.52 0.00 0.52 9 14.6 14.6 14.6 67 8.5 0.0 --- 0.00 0.0 --- 14.6 14.1 14.1 16.3 1016.2 0.00 0.0 156 0.22 156 0.0 0.00 0.0 0.003 0.000 23.9 39 9.1 23.4 0.05 23 1 100.0 1 1.8797836153192153 660.7143449269239 File 2: 2015-08-01 07:00 0.23 0.52 0.00 0.52 9 14.6 14.6 14.6 67 8.5 0.0 --- 0.00 0.0 --- 14.6 14.1 14.1 16.3 1016.2 0.00 0.0 156 0.22 156 0.0 0.00 0.0 0.003 0.000 23.9 39 9.1 23.4 0.05 23 1 100.0 1 1.8797836153192153 660.7143449269239 ..... and so on.

Tunning gain table to match two-curves

余生颓废 提交于 2019-12-25 06:34:10
问题 I have two data set, let us name them "actual speed" and "desired speed". My main objective is to match actual speed with the desired speed. But for doing that in my case, I need to tune FF(1x10), Integral(10x8) and Proportional gain table(10x8). My approach till now was as follows:- First, start the iteration with having 0.1 as the initial value in the first cells(FF[0]) of the FF table Then find the R-square or Co-relation between two dataset( i.e. Actual Speed and Desired Speed) Increment