Student Support Forum: 'Using FindRoot with FindFit' topicStudent Support Forum > General > Archives > "Using FindRoot with FindFit"

 Next Comment > Help | Reply To Topic
 Author Comment/Response David 03/18/08 3:41pm Hi all, I am trying to fit parameters in an equation that has no closed form solution. I am trying to deal with this by using a FindRoot function rather than an explicit equation in the equation part of the FindFit command. It appears as if FindFit is not correctly passing the guess values of the parameters back to FindRoot; at least that is my interpretation of what is going on. Any advice for how to deal with this problem would be appreciated. More details are below, and the program is attached. Thanks The governing equation is: Rho == 1 - Exp[-((\[Rho]^2 + Pred)/Tred) - \[Rho] (1 - 1/r + vH)] I have data for Rho that I wish to fit this equation to by adjusting parameters Pred, Tred,, vH, and r. In order to do this, I am trying to solve the equation with FindRoot inside of the FindFit function, as follows. FindFit[data, dens /. FindRoot[\[Rho] == EOS, {dens, 1000}], {{\[Rho]star, 853}, {Pstar, 475}, {Tstar, 518}, {So, -16.6}}, {T}]. where EOS is the right hand side of the equation given above. However, I am getting the following error: FindRoot::nlnum: "The function value {-1.+2.71828^(-((1. Tstar \ (101350. Power[<<2>>]+1.*10^6 Power[<<2>>]))/T)-(1000. \ (1.-<<1>>+<<1>>))/\[Rho]star)+1000./\[Rho]star} is not a list of \ numbers with dimensions {1} at {dens} = {1000.`}." ReplaceAll::reps: "{FindRoot[\[Rho]==EOS,{dens,1000}]} is neither a \ list of replacement rules nor a valid dispatch table, and so cannot \ be used for replacing." Is it not possible to combine these two commands this way? If so, why not, and is there a way for me to alter the FindFit function to make this work? Thanks Attachment: water fitting.nb, URL: ,

 Subject (listing for 'Using FindRoot with FindFit') Author Date Posted Using FindRoot with FindFit David 03/18/08 3:41pm Re: Using FindRoot with FindFit David 03/19/08 3:03pm email: Re: Using FindRoot with FindFit caspar 08/20/08 12:08pm Re: Using FindRoot with FindFit alessandro 05/20/09 4:11pm
 Next Comment > Help | Reply To Topic