Sum of square error
이전 댓글 표시
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
채택된 답변
추가 답변 (2개)
Jarrod Rivituso
2011년 4월 13일
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
2011년 4월 14일
0 개 추천
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
Mike
2011년 4월 14일
Rajiv Singh
2011년 4월 15일
Well, 1-step ahead prediction error is not the same as simulation error. If you are developing a model to fit certain previously recorded data, and the model has a nontrivial noise component the result returned from PE would be different from y-SIM(Dop, u). What type of model is Dop?
Using PE: you can call it as E = pe(model, iddata(y,u,Ts)); then the numerical error vector is E.y. Look up the help on PE for more info.
Mike
2011년 4월 15일
Rajiv Singh
2011년 4월 16일
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)
Mike
2011년 4월 18일
카테고리
도움말 센터 및 File Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!