How do I find the best fit for a cosine curve to a set of data? Specifically I'd like to fit a set of data to a damped cosine curve, but I'll take what I can get.
Quick search gave me this link: http://www.physicsforums.com/showthread.php?t=715638
It looks like you plug in points and solve for the coefficients. You have to come up with a preliminary guess for the function, though, which might be the hardest part of the process...
Well I know certain data, I'm actually going to be polling the acceleration data of a spring as it oscillates and will know the exact acceleration at approximately equal intervals of time. I will have already measured the spring constant and mass and since I am beginning the oscillation by pulling down and releasing I will know that it is a cosine curve. The only problem I think I'll have is the amplitude, but even that I suppose I can get from the data by averaging the highest and lowest point of the acceleration. I guess I'm being kind of vague but I'm really just creating this project on my own as something to do for fun, anyways thanks! Reading that gave me some ideas and new terms to search for. "Non linear regression" lol
Ooooh actually I just discoered that \[\LARGE y=Ae^{-rt}\cos(\omega t)\] is bounded by \[\LARGE y=Ae^{-rt}\] and \[\LARGE y=-Ae^{-rt}\] so that'll help simplify some things I'm considering doing.
Yeah the exponential-trig function from solving a differential equation associated with spring-mass systems. If you haven't learned about those sorts of equations or their solutions, refer to the Mechanical Vibrations section in this link, http://tutorial.math.lamar.edu/Classes/DE/SystemsModeling.aspx
*...originates from...
I have to an extent. I'll be using tricks like the wave equation. Essentially I'm creating a phone app that will act as a simple little self contained experiment for measuring a spring by cradling the phone in a bag attached to it and using the accelerometer to measure the acceleration. From there I'm looking to then show the velocity, position as a function of time after I've fit it to the damped cosine curve. So although I might not know certain things like the mass of the phone, I'll be able to back some of the info out based on what I collect as a simple little kid experiment hopefully. So depending on your level of understanding there will be alternate ways of going about it to step you through the math, but I'm only beginning to work on this so I haven't fleshed it out completely. Anyways, just thought you'd be interested, and if you have any ideas that would be cool too. =)
Sounds like a neat project! Keep us posted
Join our real-time social learning platform and learn together with your friends!