MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Nonlinear Curve Fitting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53846] Re: [mg53812] Nonlinear Curve Fitting
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 29 Jan 2005 06:02:59 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

Needs["Graphics`"];

data={{382.55,0.112531},{382.351,0.113271},{382.15,0.115013},{381.95,0.
116646}\
,{381.749,0.118108},{381.549,0.119477},{381.352,0.120815},{
        
381.15,0.122088},{380.95,0.123275},{380.75,0.124776},{380.55,0.125688}\
,{380.35,0.126676},{380.15,
      0.127719},{379.95,
        0.128744},{379.75,0.129687},{379.549,0.130706},{379.35,
      0.131595},{379.149,0.132522},{378.95,
      
0.133465},{378.75,0.134297},{378.55,0.135198},{378.35,0.135965},{378.15
,
      
0.136919},{377.95,0.137599},{377.749,0.138507},{377.55,0.139172},{377.\
35,0.140088},{377.15,0.140695},{376.95,0.141593},{376.75,0.142154},{376
.55,0.\
143089},{376.35,0.143644},{376.149,0.144522},{375.95,0.14509},{375.75,
      0.145836},{375.55,
        
0.14655},{375.35,0.147098},{375.15,0.147927},{374.95,0.148362},{374.\
749,0.149214},{374.55,0.149868},{374.35,0.150402},{374.15,0.151099},{37
3.949,
        
0.151528},{373.75,0.1524},{373.55,0.152919},{373.35,0.153435},{373.15,\
0.154261},{372.95,0.154473},{372.75,0.155232},{372.55,0.155874},{372.35
,0.\
156397},{372.149,0.156851},{371.949,0.157775},{
        371.75,0.158082},{371.55,0.158616},{
        
371.349,0.15936},{371.15,0.159811},{370.95,0.160188},{370.75,0.161122}\
,{370.55,0.16138},{370.35,0.161574},{370.15,0.162232},{369.949,0.163392
},{369.\
751,0.163124},{369.55,0.163277},{369.35,0.164757},{369.15,0.164471},{36
8.95,0.\
164512},{368.75,0.165126},{368.55,0.166819},{368.35,0.168995},{368.15,0
.\
168555},{367.95,0.168609},{367.75,0.169652},{367.55,0.169828},{367.35,0
.\
169679},{367.15,0.169972},{366.95,0.170693},{366.751,0.171106},{366.55,
0.\
171399},{366.35,0.171651},{366.15,0.172006},{365.95,0.172645},{365.75,0
.\
173137},{365.55,0.173136},{365.35,0.173773},{365.15,0.174123},{364.95,0
.\
174443},{364.75,0.174802},{364.55,0.175113},{364.35,0.175806},{364.15,0
.\
176169},{363.95,0.176401},{363.75,0.176578},{363.55,0.176953},{363.35,0
.\
177432},{363.15,0.177765},{362.95,0.177845},{362.75,0.178067},{362.55,0
.\
178569},{362.35,0.179083},{362.15,0.179272},{361.95,0.179384},{361.75,0
.\
179777},{361.551,0.180256},{361.349,0.180579},{
        361.15,0.180718},{360.95,0.181023},{
        
360.75,0.18146},{360.55,0.181936},{360.35,0.181999},{360.151,0.182136}\
,{359.95,0.182558},{359.75,0.183018},{359.55,0.183377},{
        359.35,0.183487},{359.15,0.183709},{
        358.95,0.184118},{358.75,0.184511},{
        358.55,0.184856},{358.35,0.184902},{
        
358.15,0.185134},{357.95,0.18549},{357.75,0.185944},{357.55,0.186194},\
{357.35,0.186338},{357.15,0.186497},{356.95,0.186801},{356.75,0.187286}
,{356.\
55,0.187679},{356.35,0.187856},{356.15,0.187953},{355.95,0.188292},{355
.75,0.\
188656},{355.55,0.189001},{355.35,0.189234},{355.15,0.189379},{
        354.95,0.189551},{354.75,0.189823},{354.549,0.190173},{
      354.35,0.190491},{354.15,0.19072},{353.95,0.190911},{
        353.75,0.191116},{353.55,0.19133},{
        353.35,0.191617},{353.15,0.191903},{
        352.95,0.192179},{352.75,0.192324},{
        352.55,0.192525},{352.35,0.192726},{
        
352.15,0.193037},{351.95,0.193273},{351.75,0.193512},{351.55,0.193766}\
,{351.35,0.193925},{351.151,0.194099},{350.95,0.194293},{350.75,0.19451
4},{
        350.55,0.194769},{350.35,0.195005},{
        
350.15,0.19527},{349.95,0.195444},{349.75,0.195603},{349.55,0.195743},\
{349.35,0.195977},{349.15,0.196241},{348.95,0.196497},{348.75,0.196661}
,{348.\
55,0.196848},{348.35,0.197031},{348.15,0.197189},{
        347.95,0.197359},{347.75,0.197566},{
        347.55,0.197798},{347.35,0.198015},{
        347.15,0.198241},{346.95,0.198459},{
        346.75,0.198643},{346.55,0.198803},{
        346.35,0.198968},{346.15,0.199108},{
        345.95,0.199294},{345.75,0.199527},{
        345.55,0.199761},{345.35,0.200008},{
        345.15,0.200202},{344.95,0.200311},{
        
344.75,0.200481},{344.55,0.20064},{344.35,0.200819},{344.15,0.201037},\
{343.95,0.201279},{343.75,0.201518},{343.551,0.201718},{343.35,0.20188
8},{
        
343.15,0.202039},{342.95,0.20219},{342.75,0.202339},{342.55,0.202529},\
{342.35,0.202706},{342.15,0.202881},{341.95,0.203091},{341.75,0.203274}
,{
        341.55,0.203498},{341.35,0.203684},{
        341.15,0.203875},{340.95,0.204088},{
        340.75,0.204272},{340.55,0.204489},{
        340.35,0.204658},{340.15,0.204811},{
        339.95,0.20495},{339.75,0.205069},{
        339.55,0.205247},{339.35,0.205441},{
        
339.15,0.20562},{338.95,0.205837},{338.75,0.206019},{338.55,0.206215},\
{338.35,0.206369},{338.15,0.206536},{337.95,0.206684},{337.75,0.206844}
,{337.\
55,0.206981},{337.35,0.207116},{337.15,0.207285},{
        336.95,0.207474},{336.75,0.207668},{
        336.55,0.207867},{336.35,0.208033},{
        336.15,0.208205},{335.95,0.20837},{
        335.75,0.208516},{335.552,0.208639},{
        335.35,0.208779},{335.15,0.208952},{
        334.95,0.209164},{334.75,0.209378},{334.55,0.209519},{
      334.35,0.209637},{334.15,0.209792},{
      333.95,0.209865},{333.75,0.210065},{333.55,0.210288},{
        333.35,0.210415},{333.15,0.210534},{
        332.95,0.210705},{332.75,0.210876},{
        332.55,0.211065},{332.35,0.211264},{
        332.15,0.211427},{331.95,0.211577},{
        331.75,0.211715},{331.55,0.211856},{
        331.35,0.212039},{331.15,0.212206},{330.949,0.212384},{
      
330.75,0.212548},{330.55,0.212727},{330.35,0.212883},{330.15,0.213023},
{
      329.95,0.213175},{329.75,0.21334},{329.55,0.213508},{
        329.35,0.213678},{329.15,0.21385},{
        328.95,0.213997},{328.75,0.214134},{
        
328.55,0.21429},{328.35,0.214471},{328.15,0.214574},{327.95,0.214685},\
{327.75,0.214832},{327.55,0.214982},{327.35,0.215121},{327.15,0.215276}
,{326.\
949,0.215443},{326.75,0.215625}};

xmin=Min[data[[All,1]]];
xmax=Max[data[[All,1]]];

y = a*(1 - x/c)^b;

In version 5 use FindFit

pars=FindFit[data,y, 
    {{a,0.3},{b,0.2},{c,385.2}}, x]

{a\[Rule]0.318854,b\[Rule]0.204693,c\[Rule]384.614}

Plot[Evaluate[y /. pars],{x,xmin,xmax},
    PlotStyle->Blue,
    Prolog->{Red,Point/@ data},
    Frame->True,Axes->False,
    ImageSize->400];

In earlier versions use NonlinearFit

Needs["Statistics`NonlinearFit`"];

NonlinearFit[data, y, x, 
    {{a,0.3},{b,0.2},{c,385.2}}]==
  (y /. pars)

True


Bob Hanlon

> 
> From: nilaakash at gmail.com (nilaakash)
To: mathgroup at smc.vnet.net
> Date: 2005/01/28 Fri AM 02:43:59 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg53846] [mg53812] Nonlinear Curve Fitting
> 
> Dear Friends,
>               I have tried to fit a nonlinear curve, but failed. I am
> giving my points and it's curve equation is
> 
>     \!\(y = a \((1 - x\/c)\)\^b\)
> 
> Here a, b, c are fit parameters. My initial guess is like
>    a =   0.3
>    b =   0.2
>    c = 385.2
> 
> data={{382.55, 0.112531}, {382.351, 0.113271}, {382.15, 0.115013},
> {381.95,
>     0.116646}, {381.749, 0.118108}, {381.549, 0.119477}, {381.352, 
>     0.120815}, {381.15, 0.122088}, {380.95, 0.123275}, {380.75, 
>     0.124776}, {380.55, 0.125688}, {380.35, 0.126676}, {380.15, 
>     0.127719}, {379.95, 0.128744}, {379.75, 0.129687}, {379.549, 
>     0.130706}, {379.35, 0.131595}, {379.149, 0.132522}, {378.95, 
>     0.133465}, {378.75, 0.134297}, {378.55, 0.135198}, {378.35, 
>     0.135965}, {378.15, 0.136919}, {377.95, 0.137599}, {377.749, 
>     0.138507}, {377.55, 0.139172}, {377.35, 0.140088}, {377.15, 
>     0.140695}, {376.95, 0.141593}, {376.75, 0.142154}, {376.55, 
>     0.143089}, {376.35, 0.143644}, {376.149, 0.144522}, {375.95, 
>     0.14509}, {375.75, 0.145836}, {375.55, 0.14655}, {375.35, 
>     0.147098}, {375.15, 0.147927}, {374.95, 0.148362}, {374.749, 
>     0.149214}, {374.55, 0.149868}, {374.35, 0.150402}, {374.15, 
>     0.151099}, {373.949, 0.151528}, {373.75, 0.1524}, {373.55, 
>     0.152919}, {373.35, 0.153435}, {373.15, 0.154261}, {372.95, 
>     0.154473}, {372.75, 0.155232}, {372.55, 0.155874}, {372.35, 
>     0.156397}, {372.149, 0.156851}, {371.949, 0.157775}, {371.75, 
>     0.158082}, {371.55, 0.158616}, {371.349, 0.15936}, {371.15, 
>     0.159811}, {370.95, 0.160188}, {370.75, 0.161122}, {370.55, 
>     0.16138}, {370.35, 0.161574}, {370.15, 0.162232}, {369.949, 
>     0.163392}, {369.751, 0.163124}, {369.55, 0.163277}, {369.35, 
>     0.164757}, {369.15, 0.164471}, {368.95, 0.164512}, {368.75, 
>     0.165126}, {368.55, 0.166819}, {368.35, 0.168995}, {368.15, 
>     0.168555}, {367.95, 0.168609}, {367.75, 0.169652}, {367.55, 
>     0.169828}, {367.35, 0.169679}, {367.15, 0.169972}, {366.95, 
>     0.170693}, {366.751, 0.171106}, {366.55, 0.171399}, {366.35, 
>     0.171651}, {366.15, 0.172006}, {365.95, 0.172645}, {365.75, 
>     0.173137}, {365.55, 0.173136}, {365.35, 0.173773}, {365.15, 
>     0.174123}, {364.95, 0.174443}, {364.75, 0.174802}, {364.55, 
>     0.175113}, {364.35, 0.175806}, {364.15, 0.176169}, {363.95, 
>     0.176401}, {363.75, 0.176578}, {363.55, 0.176953}, {363.35, 
>     0.177432}, {363.15, 0.177765}, {362.95, 0.177845}, {362.75, 
>     0.178067}, {362.55, 0.178569}, {362.35, 0.179083}, {362.15, 
>     0.179272}, {361.95, 0.179384}, {361.75, 0.179777}, {361.551, 
>     0.180256}, {361.349, 0.180579}, {361.15, 0.180718}, {360.95, 
>     0.181023}, {360.75, 0.18146}, {360.55, 0.181936}, {360.35, 
>     0.181999}, {360.151, 0.182136}, {359.95, 0.182558}, {359.75, 
>     0.183018}, {359.55, 0.183377}, {359.35, 0.183487}, {359.15, 
>     0.183709}, {358.95, 0.184118}, {358.75, 0.184511}, {358.55, 
>     0.184856}, {358.35, 0.184902}, {358.15, 0.185134}, {357.95, 
>     0.18549}, {357.75, 0.185944}, {357.55, 0.186194}, {357.35, 
>     0.186338}, {357.15, 0.186497}, {356.95, 0.186801}, {356.75, 
>     0.187286}, {356.55, 0.187679}, {356.35, 0.187856}, {356.15, 
>     0.187953}, {355.95, 0.188292}, {355.75, 0.188656}, {355.55, 
>     0.189001}, {355.35, 0.189234}, {355.15, 0.189379}, {354.95, 
>     0.189551}, {354.75, 0.189823}, {354.549, 0.190173}, {354.35, 
>     0.190491}, {354.15, 0.19072}, {353.95, 0.190911}, {353.75, 
>     0.191116}, {353.55, 0.19133}, {353.35, 0.191617}, {353.15, 
>     0.191903}, {352.95, 0.192179}, {352.75, 0.192324}, {352.55, 
>     0.192525}, {352.35, 0.192726}, {352.15, 0.193037}, {351.95, 
>     0.193273}, {351.75, 0.193512}, {351.55, 0.193766}, {351.35, 
>     0.193925}, {351.151, 0.194099}, {350.95, 0.194293}, {350.75, 
>     0.194514}, {350.55, 0.194769}, {350.35, 0.195005}, {350.15, 
>     0.19527}, {349.95, 0.195444}, {349.75, 0.195603}, {349.55, 
>     0.195743}, {349.35, 0.195977}, {349.15, 0.196241}, {348.95, 
>     0.196497}, {348.75, 0.196661}, {348.55, 0.196848}, {348.35, 
>     0.197031}, {348.15, 0.197189}, {347.95, 0.197359}, {347.75, 
>     0.197566}, {347.55, 0.197798}, {347.35, 0.198015}, {347.15, 
>     0.198241}, {346.95, 0.198459}, {346.75, 0.198643}, {346.55, 
>     0.198803}, {346.35, 0.198968}, {346.15, 0.199108}, {345.95, 
>     0.199294}, {345.75, 0.199527}, {345.55, 0.199761}, {345.35, 
>     0.200008}, {345.15, 0.200202}, {344.95, 0.200311}, {344.75, 
>     0.200481}, {344.55, 0.20064}, {344.35, 0.200819}, {344.15, 
>     0.201037}, {343.95, 0.201279}, {343.75, 0.201518}, {343.551, 
>     0.201718}, {343.35, 0.201888}, {343.15, 0.202039}, {342.95, 
>     0.20219}, {342.75, 0.202339}, {342.55, 0.202529}, {342.35, 
>     0.202706}, {342.15, 0.202881}, {341.95, 0.203091}, {341.75, 
>     0.203274}, {341.55, 0.203498}, {341.35, 0.203684}, {341.15, 
>     0.203875}, {340.95, 0.204088}, {340.75, 0.204272}, {340.55, 
>     0.204489}, {340.35, 0.204658}, {340.15, 0.204811}, {339.95, 
>     0.20495}, {339.75, 0.205069}, {339.55, 0.205247}, {339.35, 
>     0.205441}, {339.15, 0.20562}, {338.95, 0.205837}, {338.75, 
>     0.206019}, {338.55, 0.206215}, {338.35, 0.206369}, {338.15, 
>     0.206536}, {337.95, 0.206684}, {337.75, 0.206844}, {337.55, 
>     0.206981}, {337.35, 0.207116}, {337.15, 0.207285}, {336.95, 
>     0.207474}, {336.75, 0.207668}, {336.55, 0.207867}, {336.35, 
>     0.208033}, {336.15, 0.208205}, {335.95, 0.20837}, {335.75, 
>     0.208516}, {335.552, 0.208639}, {335.35, 0.208779}, {335.15, 
>     0.208952}, {334.95, 0.209164}, {334.75, 0.209378}, {334.55, 
>     0.209519}, {334.35, 0.209637}, {334.15, 0.209792}, {333.95, 
>     0.209865}, {333.75, 0.210065}, {333.55, 0.210288}, {333.35, 
>     0.210415}, {333.15, 0.210534}, {332.95, 0.210705}, {332.75, 
>     0.210876}, {332.55, 0.211065}, {332.35, 0.211264}, {332.15, 
>     0.211427}, {331.95, 0.211577}, {331.75, 0.211715}, {331.55, 
>     0.211856}, {331.35, 0.212039}, {331.15, 0.212206}, {330.949, 
>     0.212384}, {330.75, 0.212548}, {330.55, 0.212727}, {330.35, 
>     0.212883}, {330.15, 0.213023}, {329.95, 0.213175}, {329.75, 
>     0.21334}, {329.55, 0.213508}, {329.35, 0.213678}, {329.15, 
>     0.21385}, {328.95, 0.213997}, {328.75, 0.214134}, {328.55, 
>     0.21429}, {328.35, 0.214471}, {328.15, 0.214574}, {327.95, 
>     0.214685}, {327.75, 0.214832}, {327.55, 0.214982}, {327.35, 
>     0.215121}, {327.15, 0.215276}, {326.949, 0.215443}, {326.75,
> 0.215625}}
> 
> Please help me to find out best a, b, c fit parameters.
> 
> Thanks.
> 
> nilaakash
> 
> 


  • Prev by Date: Re: Nonlinear Curve Fitting
  • Next by Date: small puzzle programming
  • Previous by thread: Re: Nonlinear Curve Fitting
  • Next by thread: Integrate a Piecewise funition, stange behaviour