Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Nonlinearfit' topicStudent Support Forum > General > Archives > "Nonlinearfit"

Next Comment >Help
Author Comment/Response
Sabah
02/20/07 9:44pm

Dear sir/madam
I have a problem with nolinearfit, as I have wrote this program to evaluate the goodness of the fit,

Start of the program

$DefaultFont = {"Courier", 16}
(*1/6 SW APW 420.R3 *)    
fa = 96519; r = 8.314472; t = 300.0; np1 = 16; z = 1; n = 2*10^-8; vp = -0.1;
ki = 65; ke = 2;
vcrd = List[-260, -240, -220, -200, -180, -160, -140, -120, -100, -80, -60, \
-40, -20, 0, 20, 40];
vcrd = vcrd/1000.0;
icrd = List[-1119.401111, -854.4968, -705.1557692, -521.4944444, \
-372.1723333, -197.4627586, -44.48241379, 107.119655172414, 253.796666666667,
420.755357142857, 558.491071428571, 814.4564, 1208.03894736842,
1290.25578947368, 1776.5075, 2280.2];
icrd = icrd/1000.0;
tbl1 = Table[{Part[vcrd, i], Part[icrd, i]}, {i, 1, np1}];
ivpt1 = ListPlot[%, PlotStyle -> {GrayLevel[0.4], AbsolutePointSize[8.5]}]
il1 = Function[x, gl1*(x - vp)]
ip = Function[x, z*fa*n*((k1*Exp[(z*x*fa)/(2*r*t)])*
ka2 - (k2*Exp[-(z*x*fa/(2*r*t))])*ka1)/
((k1*Exp[(z*x*fa)/(2*r*t)]) + (k2*Exp[-(z*x*fa/(2*r*t))]) + ka1 + ka2)]
po = Function[x, (1/(1 + Exp[-(zgo*fa*(x - xho))/(r*t)]))]
orc = Function[x, (((
po[x]*npo*fa^2*x)/(r*t))*(
ki - ke*Exp[-(x*fa)/(r*t)]))/(1 - Exp[-(fa*x)/(r*t)])]
pi = Function[x, 1 - (1/(1 + Exp[-(zgi*fa*(x - xhi))/(r*t)]))]
irc = Function[x, (((pi[x]*npi*fa^2*x)/(r*t))*(ki - ke*Exp[-(x*
fa)/(r*t)]))/(1 - Exp[-(fa*x)/(r*t)])]
itot = Function[x, il1[x] + ip[x] + irc[x] + orc[x]]
<< Statistics`NonlinearFit`
Options[NonlinearFit]
f1 = NonlinearFit[tbl1,
itot[x], {x}, {{
gl1, 6.3}, {k1, 4500.}, {k2, 0.5}, {ka1, 0.5}, {ka2, 180.}}]
f2 = Plot[%, {x, -0.250, 0.05}]
Show[f2, ivpt1]
NonlinearRegress[tbl1,
itot[x], {x}, {{ gl1, 6.3}, {k1, 4500.}, {k2, 0.5}, {ka1, 0.5}, \
{ka2, 180.}}, RegressionReport -> {ANOVATable, AsymptoticCorrelationMatrix, \
AsymptoticCovarianceMatrix, BestFit,
BestFitParameters,
EstimatedVarianceFitCurvatureTable, FitResiduals, HatDiagonal, \
MeanPredictionCITable, ParameterBias, ParameterConfidenceRegion, \
ParameterCITable,
ParameterTable, PredictedResponse, SinglePredictionCITable, \
StartingParameters, StandardizedResiduals, SummaryReport}]



End of the program

it seems that the program worked with first two terms of the model but when I add the third and fourth terms the troubles started,this is the model itot = Function[x, il1[x] + ip[x] + irc[x] + orc[x]]

Then if I used different data, I encountered with many problems, any one can help with mattar, please
Thank you very much
Best regard
Sabah
In

URL: ,

Thread 'Nonlinearfit' is now CLOSED
Author Date Posted
Nonlinearfit Sabah 02/20/07 9:44pm
Re: Nonlinearfit Forum Modera... 02/28/07 10:50am
Re: Nonlinearfit Sabah 02/28/07 8:05pm
Next Comment >Help