Azzera filtri
Azzera filtri

How do I fit a sinusoidal curve to data? Trouble with fitit

4 visualizzazioni (ultimi 30 giorni)
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.
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 :)

Risposte (1)

sixwwwwww il 7 Dic 2013
Modificato: sixwwwwww il 7 Dic 2013
you can try curve fitting tool for this purpose. See
doc cftool
And you can try different kind of curve fittings by yourself to find out which suits your purpose well


Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by