Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scipy.optimize.curve_fit 3D

# The first argument to func must be the data (both x and y).
# The rest of the arguments to func represent the parameters.

# The first argument to curve_fit is the function.
# The second argument is the independent data (x and y in the form of one array).
# The third argument is the dependent data (z).
# The fourth argument is a guess for the value of the parameters (a and b in this case.)

import scipy.optimize as optimize
import numpy as np

A = np.array([(19,20,24), (10,40,28), (10,50,31)])

def func(data, a, b):
    return data[:,0]*data[:,1]*a + b

guess = (1,1)
params, pcov = optimize.curve_fit(func, A[:,:2], A[:,2], guess)
print(params)
# [ 0.04919355  6.67741935]
Comment

PREVIOUS NEXT
Code Example
Python :: dict to list python 
Python :: python list to set 
Python :: python text recognition 
Python :: pip ne marche pas 
Python :: get value of property of object with name python 
Python :: write code in python to Open all links on a page in separate browser tabs 
Python :: change state enabled tkinter 
Python :: check even or odd in single line 
Python :: sorted set in python 
Python :: how to get index in python 
Python :: msg91 python 
Python :: argparse for Command-Line Interface (CLI) 
Python :: PySimpleGUI multifiles select 
Python :: how to connect ip camera to opencv python 
Python :: how to install dependencies python 
Python :: sns.savefig 
Python :: python timedelta get days with fraction 
Python :: how to stop python for some time in python 
Python :: update matplotlib params 
Python :: truncate spaces in python 
Python :: sudo in python 
Python :: code pandas from url 
Python :: if any number python 
Python :: Python use number twice without variable 
Python :: compiling python code 
Python :: django convert model to csv 
Python :: pandas get highest values column 
Python :: pandas check length of string 
Python :: panda loc conditional 
Python :: how to sum numpy matrix diagonal 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =