Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 15 Online
OpenStudy (anonymous):

For polyfit or any kind of curve fitting in python, I know how to fit if we have the x=[1,2,3],y=[1,4,9] then, polyfit(x,y,n) But if given x, we have more than 1 group of y values, like x=[1,2,3],y=[ [1,2,3],[4,6],[9,10,11,12] ]. How could I fit a curve to this? The dimension of X and Y are the same, but just given X, we would have more than one observation of y. This happens in my project. When for each day, we would have multiple data points. But the question is how to find a curve to fit the data time series.

OpenStudy (anonymous):

are you using numpy or matplotlib? i take it you are trying to do 3 2d fits using the x data once and the 3 separate y observations. if that is true, you can extract the individual y observations fairly easily http://dpaste.com/801406/ if you are trying to do correlations to see how the curve changes with time then .... that sounds like a 3d problem not a 2d problem and maybe you need to create a 3d structure and use a different function or make the structure of x match y: http://dpaste.com/801410/ this is a discussion group for an introductory comp sci class - you may get better answers posting to a different group

OpenStudy (anonymous):

Thank you for your detailed explanation. I got what you mean. And for function polyfit, the same data dimensions of X, Y is allowed. Thanks

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!