Sum of square error
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I'm very new to Matlab. We are attempting to curve fit a biologic response to a sinusoidal input. I'm able to fit the curve using the system identification tool without problems. For this study we need a measured of error. I have been able to get confidence intervals but what I would like to get is the sum of squares error. I have a few questions:
- Is there a way to display the sum of square error in Matlab?
- What is the number displayed on the model output as a measure of best fit?
- When the data is presented following the estimation, it displays the loss function and the FPE. What is the FPE?
Thank you. Michael
0 commentaires
Réponse acceptée
Rajiv Singh
le 18 Avr 2011
What type of model is model1 (what does class(model1) return)? PE is a System Identification Toolbox function that would work only on models recognized by it. You can create either IDPROC or IDPOLY structure for your model.
model = idproc('p1d'); model.Kp = K; model.Td = Td; model.Tp1 = Tp1;
model = idpoly(1,K/Tp1,1,1,[1 1/Tp1],'Ts',0,'noise',0);
5 commentaires
Rajiv Singh
le 18 Avr 2011
SID files are GUI session files. You must load them into GUI to view their contents. Suppose you have a file called foo.sid, then type ident(foo) in MATLAB command window. This will launch the GUI with the session contents loaded from foo.sid. If you see any models in the modal board of the GUI, you may export them by dragging their icons onto the "To workspace" box. HTH.
Plus de réponses (2)
Jarrod Rivituso
le 13 Avr 2011
Are you trying to determine coefficients of a dynamic model, something with derivatives in it such as
dx/dt = A*x + B*u y = C*x + D*u
Or are you trying to determine coefficients of a more basic equation, such as
y = A*sin(u)+B*cos(u)
If the latter is the case, you don't need to use system identification toolbox. You could instead do a linear regression analysis in MATLAB, or there's even a curve fitting toolbox
>> cftool
Generally, it is easy in MATLAB to find the sum of square errors between two vectors. For example:
>> x1 = randn(10,1);
>> x2 = randn(10,1);
>> residuals = x2-x1;
>> sum(residuals.^2)
Rajiv Singh
le 14 Avr 2011
FPE represents a norm of the prediction error; it stands for Final Prediction Error (more details in the product documentation). The fit shown on "model output" plot is the one returned by the COMPARE command. It is:
FIT = 100(1-norm(Ymeas-Ysim)/norm(Ymeas-mean(Ymeas))) (in %)
where YMeas is the measured response and Ysim is the output of the model. Type "help compare" for more information on COMPARE.
For obtaining other error measures, you could obtain the prediction or simulation error explicitly and use it to compute your measure of fit. For prediction error use the PE command. For simulation error, you could do e = ymeas - sim(model, u) where ymeas is the measured output signal for input signal u and SIM is the command that can be used on identified models to compute the simulation response.
5 commentaires
Rajiv Singh
le 16 Avr 2011
If you are using the process model, idproc, PE can be used. For example:
E = pe(model, data)
e = E.y;
MSE = norm(e)^2/length(e)
Voir également
Catégories
En savoir plus sur Correlation Models dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!