Mathematica Mathematica to FindFit for multiple data set

AI Thread Summary
To fit multiple data sets in Mathematica using the same function, the Map[] function can be utilized effectively. By applying FindFit[] to each data set with the desired parameters, you can streamline the fitting process. An example provided shows how to use Map[] to apply the fitting function to several datasets simultaneously. The solution was confirmed to work successfully for the user. This approach simplifies the fitting of multiple datasets with different parameters in Mathematica.
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.
 

Similar threads

Replies
5
Views
9K
Replies
13
Views
2K
Replies
3
Views
2K
Replies
6
Views
4K
Replies
1
Views
2K
Back
Top