Skip to content
Permalink
3ad1649002
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
28 lines (18 sloc) 432 Bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 12:33:27 2019
@author: nolte
"""
import numpy as np
from scipy import integrate
from matplotlib import pyplot as plt
import networkx as nx
def linfit(x,y):
meanx = np.mean(x)
meany = np.mean(y)
meanxy = np.mean(x*y)
meanx2 = np.mean(x**2)
m = (meanxy - meanx*meany)/(meanx2 - meanx**2)
b = meany - m*meanx
return m, b