Periodogram in Octave/Matlab vs Scipy

前端 未结 4 830
臣服心动
臣服心动 2021-01-02 07:54

I am porting some matlab code to python using scipy and got stuck with the following line:

Matlab/Octave code



        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 08:15

    I faced the same problem but then I came across the documentation of scipy's periodogram

    As you would see there that detrend='constant' is the default argument. This means that python automatically subtracts the mean of the input data from each point. (Read here). While Matlab/Octave do no such thing. I believe that is the reason why the outputs are different. Try specifying detrend=False, while calling scipy's periodogram you should get the same output as Matlab.

提交回复
热议问题