user12268456
user12268456

Reputation:

Linear approximation

I want to perform a linear approximation and get the linear equation of my data from the array of data in python. I was thinking about using:

np.polyfit(x,y,1).

But the problem is that my equation is

y=ax+b, b=0

So I need to calculate only parameter a. Can you suggest something?

Upvotes: 0

Views: 775

Answers (1)

Mohsen_Fatemi
Mohsen_Fatemi

Reputation: 3401

What you are looking for called Linear Regression, take a look at this link for more description.

Upvotes: 1

Related Questions