Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica to FindFit for multiple data set

  1. Mar 5, 2013 #1
    After conducting my experimental work I will have a number of sets of data.

    It is easy to use Mathematica to find a fit of just one set, but I would like to fit all sets at once as they are too many to do them all ate once.
    They will all be fitted by the same function say y=ax+b, every set having a different value of a and b.

    How do I do this?
    Thanks in advance.
    Sue
     
  2. jcsd
  3. Mar 5, 2013 #2
    Without a concrete specific example it is perhaps difficult to know exactly what the answer should be.

    Usually if you want to "do the same thing to a collection of items" Map[] is the solution.

    data1={...};
    data2={...};
    data3={...};
    Map[FindFit[#,a x+b,{a,b},x]&,{data1,data2,data3}]

    may do what you want.

    http://reference.wolfram.com/mathematica/ref/Map.html
     
    Last edited: Mar 5, 2013
  4. Mar 5, 2013 #3
    Thank you very much Bill, it is working.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica to FindFit for multiple data set
Loading...