How do I fit a sinusoidal curve to data? Trouble with fitit
1 view (last 30 days)
Show older comments
Hello, I am new to Matlab and am working on a final project for school. I would like some assistance with figuring out what to do with a data set. I basically modeled certain fashion trends over time and assigned a certain fashion trend with values ranging from 1 to 5.
Here's my time (x axis) vector: t=1900:5:1995;
Here's my y-data vector: shoulders = [5 4 3 2 2 1 3 4 5 5 4 3 3 1 2 2 5 5 5 3];
I feel like the data oscillates and I would like a sinusoidal function to fit my data points, how do I do this? I tried googling it and found a function called fitit that a user made, but when I tried to run it, it says that my X value didn't match up with my rows. I don't quite fully understand the whole program, so I would like some help in understanding where in the program I change the number of rows it requires to just 1.
Here's the link: http://www.mathworks.com/matlabcentral/fileexchange/31562-data-driven-fitting-with-matlab
Since I only have 20 data points, if that is not enough data points for fitit to work well, what other functions can I use to fit my sinusoidal functions? Sorry, I'm just not super comfortable with curve fitting oscillations and would like as much help as possible :)
0 Comments
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!