Hi,
I'm using Mathematica 9. I made some code (full code update):
Data = Import["E:\\EuFe2As2-based\\Math\\Cp\\Cp_Eu12A1_t4", "Table"];
pun = Select[Data, First[#] > 150 &];
ListPlot[pun]
CDeb[n_, t_, thD_] = n*9*8.31 (t/thD)^3 Integrate[ x^4 Exp[x]*(Exp[x] - 1)^-2, {x, 0, thD/t}];
CEl[t_, gamma_] = gamma*t;
Cp[n_, t_, thD_, gamma_] = CDeb[n, t, thD] + CEl[t, gamma];
n = 5;
fitt = FindFit[pun, Cp[n, T, ThetaD, GammA], {{ThetaD, 330}, {GammA, 0.1}}, T];
modelFunk = Function[{T}, Evaluate[Cp[n, T, ThetaD, GammA] /. fitt]];
Plot[modelFunk[T], {T, 0, 300}, Epilog -> Map[Point, pun]]
tablica =
Table[{Temp, Re[CEl[Temp, GammA] /. fitt], Re[CDeb[n, Temp, ThetaD] /. fitt], Re[modelFunk[Temp]]}, {Temp, 0.1, 30, 5];
Export["c:/daneCp.csv", tablica, "CSV"]
and in the line with the FindFit I got somthing like this:
FindFit::nrlnum: The function value {Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined} is not a list of real numbers with dimensions {39} at {ThetaD,GammA} = {330.,0.1}. >>
FindFit::nrlnum: The function value {Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined} is not a list of real numbers with dimensions {39} at {ThetaD,GammA} = {330.,0.1}. >>
I have no idea what's going on with it. The line with FindFit works fine in mathematica 7, but in 9 doesn't. Any suggestions?