From: Andrew Scribner on 5 Jul 2010 15:56 I am looking to find the best function to describe a set of discrete data points Ive collected. I have a large discrete data set with several independent variables and I want to be able to prescribe several different empirical equations (separately) to see their ability to describe my data. For example, say I have a set of data with three independent parameters (A, B, and C) and a result (R). I might suggest that the data would best be described by: R=a*(A^u)(B^v)(C^w) where a, u, v, and w are all empirical correlation constants. I would like the code to find the best a, u, v, and w to fit my data over the entire range of A,B,C,R data. The data I am feeding the function is non-linear and has scatter. I was thinking of using something like a genetic algorithm search, but the problem with that is that I need to have an .m file function for fitness and I'm having trouble seeing how to write such a file for this kind of problem. The examples Ive seen using the various optimization functions tend to have a given function that will be optimized, but in this case I have data that I want to fit to a function. Should I make a .m file that loads all my data, computes (R-a*(A^u)(B^v)(C^w)) for every data point, and then looks to minimize that difference as it changes a,u,v,w? If so, the data set I would have to load in every call of the .m function is large, so would there be a good way to do this that would minimize the run time? Am I missing something here, or approaching this problem in the wrong way? I'm moderately skilled in MATLAB, but very novice in optimization. Any suggestions to solving this problem would be very appreciated. I just can't seem to wrap my head around fitting a function to data as opposed to a function.
From: Steven Lord on 5 Jul 2010 22:43 "Andrew Scribner" <iwantgames(a)hotmail.com> wrote in message news:i0tdcl$1r9$1(a)fred.mathworks.com... >I am looking to find the best function to describe a set of discrete data >points Ive collected. I have a large discrete data set with several >independent variables and I want to be able to prescribe several different >empirical equations (separately) to see their ability to describe my data. >For example, say I have a set of data with three independent parameters (A, >B, and C) and a result (R). I might suggest that the data would best be >described by: > R=a*(A^u)(B^v)(C^w) > where a, u, v, and w are all empirical correlation constants. > I would like the code to find the best a, u, v, and w to fit my data over > the entire range of A,B,C,R data. The data I am feeding the function is > non-linear and has scatter. I was thinking of using something like a > genetic algorithm search, but the problem with that is that I need to have > an .m file function for fitness and I'm having trouble seeing how to write > such a file for this kind of problem. The examples Ive seen using the > various optimization functions tend to have a given function that will be > optimized, but in this case I have data that I want to fit to a function. > Should I make a .m file that loads all my data, computes > (R-a*(A^u)(B^v)(C^w)) for every data point, and then looks to minimize > that difference as it changes a,u,v,w? If so, the data set I would have to > load in every call of the .m function is large, so would there be a good > way to do this that would minimize the run time? > Am I missing something here, or approaching this problem in the wrong way? > I'm moderately skilled in MATLAB, but very novice in optimization. Any > suggestions to solving this problem would be very appreciated. I just > can't seem to wrap my head around fitting a function to data as opposed to > a function. Pass the data into the function as additional parameters to the objective function. http://www.mathworks.com/support/solutions/en/data/1-19HM6/?solution=1-19HM6 -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Andrew Scribner on 7 Jul 2010 09:59 Perfect, thank you very much for your help. Andrew "Steven Lord" <slord(a)mathworks.com> wrote in message <i0u58e$n6f$1(a)fred.mathworks.com>... > > "Andrew Scribner" <iwantgames(a)hotmail.com> wrote in message > news:i0tdcl$1r9$1(a)fred.mathworks.com... > >I am looking to find the best function to describe a set of discrete data > >points Ive collected. I have a large discrete data set with several > >independent variables and I want to be able to prescribe several different > >empirical equations (separately) to see their ability to describe my data. > >For example, say I have a set of data with three independent parameters (A, > >B, and C) and a result (R). I might suggest that the data would best be > >described by: > > R=a*(A^u)(B^v)(C^w) > > where a, u, v, and w are all empirical correlation constants. > > I would like the code to find the best a, u, v, and w to fit my data over > > the entire range of A,B,C,R data. The data I am feeding the function is > > non-linear and has scatter. I was thinking of using something like a > > genetic algorithm search, but the problem with that is that I need to have > > an .m file function for fitness and I'm having trouble seeing how to write > > such a file for this kind of problem. The examples Ive seen using the > > various optimization functions tend to have a given function that will be > > optimized, but in this case I have data that I want to fit to a function. > > Should I make a .m file that loads all my data, computes > > (R-a*(A^u)(B^v)(C^w)) for every data point, and then looks to minimize > > that difference as it changes a,u,v,w? If so, the data set I would have to > > load in every call of the .m function is large, so would there be a good > > way to do this that would minimize the run time? > > Am I missing something here, or approaching this problem in the wrong way? > > I'm moderately skilled in MATLAB, but very novice in optimization. Any > > suggestions to solving this problem would be very appreciated. I just > > can't seem to wrap my head around fitting a function to data as opposed to > > a function. > > Pass the data into the function as additional parameters to the objective > function. > > http://www.mathworks.com/support/solutions/en/data/1-19HM6/?solution=1-19HM6 > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com >
|
Pages: 1 Prev: Mex compiling problem Next: reading different structures |