I need to use Non Linear Regression like in the video but for my text file called ammonia. I started and i am getting errors I do not know how to solve.
import numpy as np
from plotly.subplots import make_subplots
data= np.loadtxt("ammonia.txt", skiprows=5)
print(data)
T= data[:,0]
logP= np.log10(data[:,1])
fig = make_subplots(rows=1, cols=1)
fig.add_scatter(x=T, y=logP, mode='markers', name='Data')
fig.update_layout(height=600, width=800)
X= np.c_[T, -logP, np.ones_like(T)]
A,C,D = np.linalg.inv(X,T@X)@X.T@(T*logP)
B= (A*C) - D
Tplot= np.linspace(min(T), max(T), 100)
fig.add_scatter(x=Tplot, y= A - (B/(Tplot+C)), mode= 'lines', name='Linear Regression')
199.2626.1880.0040.01 203.1148.2610.0040.01 206.58710.6080.0040.01 210.81114.1810.0040.01 214.4218.0170.0040.01 218.35423.1260.0040.01 224.24632.980.0040.01 229.20543.7250.0040.01 234.8459.2480.0040.01 241.58583.5350.0040.01