import numpy as np from lmfit import minimize, Parameters, fit_report import matplotlib.pyplot as plt import maxwell as m import freqTest as ft # stevilo praznih vrstic prazneVrstice = 5 # imena datotek s podatki file1 = 'S1GelanP0.5T20.csv' file2 = 'S1GelanP0.7T20.csv' file3 = 'S1GelanP1.0T20.csv' # uvozimo podatke omega1, G1_1, G2_1 = ft.podatki(file1, prazneVrstice) omega2, G1_2, G2_2 = ft.podatki(file2, prazneVrstice) omega3, G1_3, G2_3 = ft.podatki(file3, prazneVrstice) # stevilo maxwellovih elementov N1 = 6 N2 = 6 N3 = 5 # nastavimo zacetne vrednosti in omejitve parametrov par1 = Parameters() for i in range(1,N1+1): gstr = 'g'+str(i) lstr = 'l'+str(i) par1.add(gstr,value=1,min=1.e-7) par1.add(lstr,value=1,min=1.e-7)
import numpy as np from lmfit import minimize, Parameters, fit_report import matplotlib.pyplot as plt import maxwell as m import freqTest as ft # stevilo praznih vrstic prazneVrstice = 5 # imena datotek s podatki file1 = '1skupina.csv' # uvozimo podatke omega, G1, G2 = ft.podatki(file1, prazneVrstice) # stevilo maxwellovih elementov N = 5 # nastavimo zacetne vrednosti in omejitve parametrov par = Parameters() for i in range(1, N + 1): gstr = 'g' + str(i) lstr = 'l' + str(i) par.add(gstr, value=1, min=1.e-4) par.add(lstr, value=1, min=1.e-4) # minimizacija napake - non-linear least squares method out = minimize(ft.maxwell, par, args=(N, omega, G1, G2), method='leastsq') # pridobimo parametre iz fitanja g, l = ft.koeficienti(par, N)