Get Y values from Curve Fitting Tool
48 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Samuel Fonseca
le 5 Avr 2012
Commenté : Bixing Yan
le 8 Juin 2016
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
0 commentaires
Réponse acceptée
Richard Willey
le 5 Avr 2012
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 commentaires
Bixing Yan
le 8 Juin 2016
Hi Samuel, I am wondering what is the easy to get the value of fitted model?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!