England captain Alastair Cook believes his side have found some form at just the right time after beating New Zealand by 34 runs at Trent Bridge.