I want to fit multiple data set and plot the result on the same graph, what I' am doing is:
do for [i=2:500]{
fit f(x) "myData" using 1:i via a,b
plot f(x)
}
The fit works fine, the big problem is that this code produce a different plot at each iteration. I would like to have all the fitted functions in a single graph. Is there any way ?
I guess you cannot fit and plot in the same loop. Well, there would be the
multiplot
environment (checkhelp multiplot
), but I guess this is not your idea. So, you can fit in ado for
loop and store the fitted parameters in an array for later use during plotting. You didn't specify any function, so I assumed something. Check the following minimized example:Code:
Result: