Linear Regression and Curve Fitting
Show older comments
I have a model and some data I'd like to fit to it: X_t = B1*cos(2*pi*omega*t) + B2*sin(2*pi*omega*t) + eta_t
What function would I use to conduct linear regression here, to find B1 and B2?
Accepted Answer
More Answers (1)
Jos (10584)
on 4 Dec 2013
You might be interested in the function REGRESS
X = [cos(2*pi*omega*t(:)) sin(2*pi*omega*t(:))]
B = regress(Y,X)
If you want to specify an offset B(3), add a column of ones to X
X(:,3) = 1
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!