A method for estimating an impedance of a battery, the method comprising the steps of: acquiring data of the battery during at least a predetermined time range, the data comprising at least a plurality of voltage measurements and a plurality of current measurements, determining a time window within the predetermined time range, the time window starting after a relaxed voltage interval and comprising a dynamic load interval, determining an initial voltage, the initial voltage being the voltage measurement at the start of the time window, determining (S1400, S4400) a plurality of dynamic voltages based on the voltage measurements in the time window and the initial voltage, executing a subspace identification analysis (S1500, S5500) based on the plurality of current measurements and on the plurality of dynamic voltages, computing the impedance from an output of the subspace identification analysis, wherein the step of determining the dynamic voltage comprises the steps of: determining an estimated initial state of charge based on the initial voltage, the estimated initial state of charge being the estimated state of charge at the start of the time window, determining a plurality of estimated states of charge throughout the time window based on the estimated initial state of charge, determining a plurality of estimated open circuit voltages throughout the time window based on the estimated plurality of states of charge, determining the plurality of dynamic voltages as, at any given time throughout the time window, a difference between the voltage measurement and the respective estimated open circuit voltage at the given time. acquiring data of the battery during at least a predetermined time range, the data comprising at least a plurality of voltage measurements and a plurality of current measurements, determining a time window within the predetermined time range, the time window starting after a relaxed voltage interval and comprising a dynamic load interval, determining an initial voltage, the initial voltage being the voltage measurement at the start of the time window, determining (S1400, S4400) a plurality of dynamic voltages based on the voltage measurements in the time window and the initial voltage, executing a subspace identification analysis (S1500, S5500) based on the plurality of current measurements and on the plurality of dynamic voltages, computing the impedance from an output of the subspace identification analysis, wherein the step of determining the dynamic voltage comprises the steps of: determining an estimated initial state of charge based on the initial voltage, the estimated initial state of charge being the estimated state of charge at the start of the time window, determining a plurality of estimated states of charge throughout the time window based on the estimated initial state of charge, determining a plurality of estimated open circuit voltages throughout the time window based on the estimated plurality of states of charge, determining the plurality of dynamic voltages as, at any given time throughout the time window, a difference between the voltage measurement and the respective estimated open circuit voltage at the given time. determining an estimated initial state of charge based on the initial voltage, the estimated initial state of charge being the estimated state of charge at the start of the time window, determining a plurality of estimated states of charge throughout the time window based on the estimated initial state of charge, determining a plurality of estimated open circuit voltages throughout the time window based on the estimated plurality of states of charge, determining the plurality of dynamic voltages as, at any given time throughout the time window, a difference between the voltage measurement and the respective estimated open circuit voltage at the given time.