Atletico Madrid have signed Martin Demichelis on a free transfer after his contract with Malaga expired earlier this summer.