Get Y values from Curve Fitting Tool

48 ビュー (過去 30 日間)
Samuel Fonseca
Samuel Fonseca 2012 年 4 月 5 日
コメント済み: Bixing Yan 2016 年 6 月 8 日
First of all i´m completely new on matlab so forgive me if this is a dumb question...
I have a time-series like set of measures. I need to fit a custom equation (similar to fourier).. so I did that using curve fitting tool (Matlab 2011a) and got a nice fit
General model:
f(x) = a0+a1*cos(2*pi*x/c1)+b1*sin(2*pi*x/c1)+a2*cos(2*pi*x/c2)+b2*sin(2*pi*x/c2)
Coefficients (with 95% confidence bounds):
a0 = 19.34 (19.2, 19.47)
a1 = 0.1146 (-0.07393, 0.3032)
a2 = -0.5118 (-0.7003, -0.3232)
b1 = -2.76 (-2.948, -2.571)
b2 = 0.278 (0.08949, 0.4666)
c1 = 12 (fixed at bound)
c2 = 6 (fixed at bound)
now I need the values of the fitted curve so I wonder if there is a fast and simple way to get them.
P.D. I know I can just calculate them from the model using the calculated coefficients but I have 100+ series of data, each one with a different set of coefficient values.
Any help would be appreciated

採用された回答

Richard Willey
Richard Willey 2012 年 4 月 5 日
For simplicity, this code is using a simple linear model. However, the same syntax with work for your nonlinear regression.
% Generate some data
X = 10 * rand(100,1);
Y = 5 + 3*X + randn(100,1);
% Generate a fit
myFit = fit(X,Y, 'poly1');
% Generate YHat
YHat = myFit(X)
% Alternatively
Yhat = feval(myFit, X)
  2 件のコメント
Samuel Fonseca
Samuel Fonseca 2012 年 4 月 5 日
THX A LOT!!
I knew there was a easy way to do it
Bixing Yan
Bixing Yan 2016 年 6 月 8 日
Hi Samuel, I am wondering what is the easy to get the value of fitted model?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet 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