curve fitting estimate parameter - inverse square law

前端 未结 2 971
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-26 14:28

I want to make a plot force vs position (for coulomb\'s law) and estimate the constant e0. I have the values of charges , q1=1,q2=1. I have for example the

pos         


        
相关标签:
2条回答
  • 2021-01-26 14:59

    There are a couple of reasons this is wrong. Firstly, you've missed some parentheses out of your definition of Coulomb's law. It should be

    F = 1/(4*pi*e0) * q1 * q2 * r^-2
    

    This means that your final calculation of e0 should go like

    a = 10^p(2);
    e0 = ((q1 * q2) / (4 * pi)) / a;
    

    The other reason this is wrong is that, in fact, the definition of the law is still wrong for your context. You have only positive charges (q1, q2) there, but clearly the force goes negative at some point. Since you're working in log-space to estimate the parameters, this is not going to work as you will get a complex number out. Your definition of Coulomb's law for your data should be

    |F| = 1/(4*pi*e0) * |q1 * q2| * r^-2
    

    That is, you only have the absolute values. Therefore you should do the fitting using abs(force) instead of just force.

    0 讨论(0)
  • 2021-01-26 15:07

    Since a= (q1*q2/4*pi*e0), e0 should be

    e0=a/(q1*q2/4*pi)
    

    Check it.

    0 讨论(0)
提交回复
热议问题