graphing norm of residuals
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MOH
el 28 de Oct. de 2021
Comentada: Walter Roberson
el 28 de Oct. de 2021
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 comentarios
Bjorn Gustavsson
el 28 de Oct. de 2021
Do you mean graph the residuals as fminsearch progresses? Or graph the different terms that goes into your non-linear equation? Or something else?
Respuesta aceptada
Walter Roberson
el 28 de Oct. de 2021
You can create an options structure that specifies PlotFcn https://www.mathworks.com/help/matlab/math/plot-functions.html
The particular field you would want to plot is named fval
5 comentarios
Walter Roberson
el 28 de Oct. de 2021
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
el 28 de Oct. de 2021
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 .
Más respuestas (0)
Ver también
Categorías
Más información sobre Graph and Network Algorithms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!