How to minimize residual error (i.e., cost function) using least squares?
12 次查看(过去 30 天)
显示 更早的评论
I have a data set, 'x' and 'xhat', where 'x' is the experimental data and 'xhat' is calculated. The cost functions are b1, b2 and b3 - these are the values that need to be minimized to reduce the residual error. M is previously calculated elsewhere in the script.
% x is the experimental data
T = 100 + b1
K = b2 + b3 * M^2
xhat = T + (T * K * M^2) % xhat is supposed to be calculated
res=x-xhat % residual error
min(b1,b2,b3)= sum(||res||).^2 % Least squares - Levenberg-Marquardt Algorithm
Having never worked with cftool before, can someone assist me in finding the values of the cost function?
Thanks in advance!
0 个评论
回答(1 个)
Shubh Sahu
2019-12-31
Load your dataset in workspace and then open cftool. Select data to fit in curve. Select the model type 'custom' and input the whole equation which you want to minimize. Please refer to these links for further help :
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!