Mathematica to FindFit for multiple data set

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 4K views
Sue Laplace
Messages
10
Reaction score
0
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
 
Physics news on Phys.org
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:
Thank you very much Bill, it is working.