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

조회 수: 1 (최근 30일)
Michelle
Michelle 2013년 12월 7일
편집: sixwwwwww 2013년 12월 7일
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 :)

답변 (1개)

sixwwwwww
sixwwwwww 2013년 12월 7일
편집: sixwwwwww 2013년 12월 7일
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

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by