function-fitting

Python surface fitting of variables of different dimensionto get unknown parameters?

。_饼干妹妹 提交于 2021-01-27 23:43:39
问题 I have a function that includes x and y as independent variables and I want to fit the parameters to the data and function and plot a surface figure. I saw that if the variables have two different dimensions, I can use np.meshgrid(x,y) , but then how do I find the parameters a,b,c? My code looks like this: import matplotlib.pyplot as plt from scipy.optimize import curve_fit import numpy as np x = np.array([1,0.5,0.33,0.25,0.2]) y = np.array([1e-9,1e-8,1e-7,1e-6,1e-5,1e-4,1e-3,1e-2,1e-1,1e0

Fitting with constraints on derivative Python

蓝咒 提交于 2019-12-01 09:57:18
问题 While trying to create an optimization algorithm, I had to put constraints on the curve fitting of my set. Here is my problem, I have an array : Z = [10.3, 10, 10.2, ...] L = [0, 20, 40, ...] I need to find a function that fits Z with condition on slope which is the derivative of the function I'm looking for. Suppose f is my function, f should fit Z and have a condition on f its derivative, it shouldnt exceed a special value. Are there any libraries in python that can help me achieve this

Fitting with constraints on derivative Python

佐手、 提交于 2019-11-29 12:51:17
While trying to create an optimization algorithm, I had to put constraints on the curve fitting of my set. Here is my problem, I have an array : Z = [10.3, 10, 10.2, ...] L = [0, 20, 40, ...] I need to find a function that fits Z with condition on slope which is the derivative of the function I'm looking for. Suppose f is my function, f should fit Z and have a condition on f its derivative, it shouldnt exceed a special value. Are there any libraries in python that can help me achieve this task ? The COBYLA minimzer can handle such problems. In the following example a polynomial of degree 3 is