I have the two m files given below. "a" and "T" are returned as complex with the coefficient of the complex part being zero (the real part gives the correct answer and hence the plot is fine) . Also dadT is becoming complex.