In Field Car Battery testing
The algorithm is simple enough. Just correlate the temperature of the battery to the source impedance at that temperature. A battery's internal impedance increase as either the anode or cathode material is worn down by repeated chemical reactions. You will have to measure the batteries at the "same charge" which is to say that a LA battery with little charge, but is still a good battery will have a higher impedance than a fully charged bad battery. Either test them when they're all freshly charged or when they're all completely spent.

You can find the impedance of a battery by testing it's open circuit voltage, Vo, and testing the voltage across a known resistor, Vl and R. You plug all that information into this equation: internal Resistance = [R*(Vo-Vl)]/Vl

This isn't a very practical method unfortunately since you'd have to disconnect the battery to run this test. However, it's the only one I know. Internal Impedance is really the only tell-tale sign of a bad battery.