Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to fit experimental data (temp,alpha) to the following equation for calculating k and Ea

    -Log[alpha]^n = function(k,Ea,temp)

However i do not know exact value of "n". By this time i am using trial and error for "n" and select value based on the maximum r^2 , but this is time consuming and value of may be inaccurate.

Is there any method, through which i can get the optimum value on "n" based on a specified range i.e. 2 to 3, along with k and Ea for which r^2 is the best one.

Here is my code. i am sorry if it seems messy

    data = Import["data.xlsx", {"Sheets", "control", All, {1, 2, 3}}];
    R = 0.008314; Ea =.; k =.; RHS =.; T =.; n =.; b = 10; n =.; temp =.;
    alpx =.;
    RHS = Integrate[k/b Exp[-(Ea/R) (1/T - 1/370)], T];
    model = RHS;
    n = 3.1;
    alpx = data[[All, 2]]^(1/n);
    temp= data[[All, 1]];
    alp = data[[All, 3]];
    bb = Table[{(alpx[[i]]), temp[[i]]}, {i, 1, Length[temp]}];
    sol = NonlinearModelFit[bb, model, {k, Ea}, T] //Chop;
    newRHS = Normal[sol];
    sol[{"BestFitParameters", "ParameterTable", "EstimatedVariance", 
    "ANOVATable", "RSquared"}]

    Plot[(Exp[-newRHS^n]), {T, 360, 400}, PlotStyle -> {Black, Thick}, 
    Frame -> True, 
    FrameLabel -> {Style["Temperature(K) ", 16], 
    Style["Relative crystallinity  ", 16]}, GridLines -> Automatic, 
    PlotLabel -> "Control", ImageSize -> Medium];
share|improve this question
    
The data i m using is here pastebin.com/X45XKntR –  Farrukh Shehzad Jan 24 at 7:11
1  
You can make n a parameter of your model and add the constraint as in NonlinearModelFit[..., {model, 2<=n<=3}, {k, Ea, n}, T]. –  b.gatessucks Jan 24 at 8:19
    
In such cases I usually wrap the whole fitting procedure by Manipulate where n is the Manipulate parameter, varying, say, from 1 to 4. Then you may do all this fast. Another thing, your model function is expressed by an integral that can be calculated analytically. I guess it would be better to substitute explicitly its value. –  Alexei Boulbitch Jan 24 at 8:32
    
@AlexeiBoulbitch one thing is that i can use an approximation for this integral . but i am thinking that mathematica will give a better answer as compared to other approximations. and for the option of manipulate let me try it but it will take a lot of time as i have many sample's data for analysis and their value of "n" may be different. –  Farrukh Shehzad Jan 24 at 11:14
    
@b.gatessucks let me check this method. –  Farrukh Shehzad Jan 24 at 11:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.