Error trying to define an output function
Mostra commenti meno recenti
Hello to everybody!! I can't understand how to correctly define an output function. I tried to define a function which plot the histogram of residuals on each iteration on this way:
function stop=his(x,optimValues,state)
stop=false;
switch state
case 'init'
figure
title('residual_plot')
case 'iter'
plot(histogram(optimValues.residual,15))
otherwise
end
But I recived this error:
Error using plot
Not enough input arguments.
Error in his (line 8)
plot(histogram(optimValues.residual,15))
I used lsqnonlin with 'OutputFcn' option.
I hope somebody could help me. Thanks
Risposta accettata
Più risposte (1)
Image Analyst
il 9 Dic 2016
I don't know what the purpose of stop is. You don't even use it, and you shouldn't even use it because it's a built-in function that stops the time.
histogram does the plotting by itself, so don't pass it to plot(). Just call it:
histogram(optimValues.residual, 15);
grid on;
You should fancy it up by setting xlabel and ylabel, you can set the bar color, and the bar edge color and bar width, etc.
1 Commento
MtPt
il 9 Dic 2016
Categorie
Scopri di più su Histograms in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!