pybamm-team / pybamm-eis

https://pybamm-eis.readthedocs.io/
MIT License
10 stars 2 forks source link

Avoiding spectral leakage in time domain (brute force) simulation #16

Closed noelhallemans closed 1 month ago

noelhallemans commented 1 month ago

Hi,

To compute the impedance in the time domain in examples/compare_methods.py the model response to a sinusoidal current is computed.

To avoid spectral leakage when taking the FFT I recommend to simulate an integer number of periods.

This can be solved by removing the 1+ on line 38 and -1 on lines 41 to 43.

The difference between frequency domain and time domain simulations will then become smaller!

Kind regards,

Noël

rtimms commented 1 month ago

Sounds good, thanks for spotting this! Can you open a PR with the fix?

rtimms commented 1 month ago

Fixed by #17