If you generously allow two hours to get through the airport gauntlet, then another hour to get to the “T4 Aeropuerto” train station below Terminal 4, buy your train ticket from the machine and take the 31-minute Cercanias train to Atocha station— you can be at Madrid Atocha train station by 9am. Once at Atocha, walk to the security checkpoint for high-speed trains where you put your luggage through a machine ( takes a couple minutes) collect your luggage and walk to the train platforms where the trains depart. This all should take 20 minutes so allow 30 minutes.
You should be able to take Renfe’s 10am AVE train or IRYO’s 10:35am Frecciarosa train to Cordoba. The trains take about 1:45 to reach Cordoba. For the best price, buy a 2nd class “Basico” Renfe online ticket for $59 or the IRYO online “Inicial” ticket for $44. These are prices for non-refundable tickets and they are the current price online. Like airline tickets, train tickets in Europe only rise in price as the clock ticks.
Check www.TheTrainline.com and www.IRYO.eu and www.Renfe.com for details.