Fitting a sin function to a sparse dataset with a known parameter.
Show older comments
Question #4 in the last few days... Thank you all for the help so far!
I have a sparse dataset (4 points, soon 5) of an environmental variable whose concentration changes as a function of time of year, and whose shape I know approximates a sin wave, i.e.
var(t) = a1 * (sin(2*pi/365days)*t+b1)+c1
I know the frequency of the function, but I don't know the amplitude (a1), phase offset (b1) or offset in y (c1), so I'd like to fit a sin function to it.
Question: Is there a function that will allow me to specify a given known parameter (frequency) and that will solve for the remaining unknowns (amp, phase, y offset)? I've tried using cftool, but as far as I can tell, it doesn't allow me to specify frequency. And I've started to try to use the fit function, but I'm having a hard time sorting out how to format my input variables.
TIA, Jonathan
Accepted Answer
More Answers (0)
Categories
Find more on Linear and Nonlinear Regression 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!