graphing norm of residuals

13 次查看(过去 30 天)
I used the fminseach to fit non linear equation , how I can graph the residuals . when I seached it I saw it in the graph tool box . how I can graph it if I'm not using the tool box?
  2 个评论
Bjorn Gustavsson
Bjorn Gustavsson 2021-10-28
Do you mean graph the residuals as fminsearch progresses? Or graph the different terms that goes into your non-linear equation? Or something else?
MOH
MOH 2021-10-28
Graphing the residuals as fminsearch progresses

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2021-10-28
You can create an options structure that specifies PlotFcn https://www.mathworks.com/help/matlab/math/plot-functions.html
You can create a custom plot function; https://www.mathworks.com/help/optim/ug/output-function.html
The particular field you would want to plot is named fval
  5 个评论
Walter Roberson
Walter Roberson 2021-10-28
I posted the link above to the structure needed for custom plot functions; you would create such a function (start by copying optimplotfval) and then you would specify it as a PlotFcn in your options.
The difference compared to the existing optimplotfval is that you would need to deliberately plot abs(fval) and so would have the odd situation where the plot would get worse as the fval got more negative.
If you are certain that the output of your function is strictly non-negative, then you can just specify @optimplotfval as your PlotFcn in your options, without having to do anything more. This would not strictly be norm(fval) but it would have the same output provided that the function is strictly >= 0
Walter Roberson
Walter Roberson 2021-10-28
Perhaps you have structured your search along the lines of
[bestpara, bestresidue] = fminsearch(@(parameters) objective(parameters, xdata, ydata), x0);
function residue = objective(parameters, xdata, ydata)
predictions = some function of parameters and xdata
residue = norm(predictions - ydata);
end
If so then to plot the residues, add options to the fminsearch call with 'PlotFcn' of @optimplotfval .

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by