From: Nazanin on
Hi,
I am using Matlab optimization tool box and I want to plot
the value of the function being optimized as well as the value of its parameters.

I want all the functions to be plot so I set:
PlotFcns = {@optimplotx,@optimplotfunccount,@optimplotfval,..
@optimplotstepsize,@optimplotfirstorderopt};

My problem is when in the function "callAllOptimPlotFcns" the command

state(i) = feval(plotNames{i},x,optimvalues,'init',varargin{:});

is called, the arguments are more than what e.g. "optimplotx" or other functions in PlotFcn are allowed to have! so as a result I get the error:
??? Error using ==> optimplotx
Too many input arguments.

I would appreciate it if anyone can help me with that,

Thanks,
Nazanin
From: Steven Lord on

"Nazanin " <nazanin_aghaloo(a)yahoo.com> wrote in message
news:hdo20a$gvc$1(a)fred.mathworks.com...
> Hi,
> I am using Matlab optimization tool box and I want to plot
> the value of the function being optimized as well as the value of its
> parameters.
>
> I want all the functions to be plot so I set:
> PlotFcns = {@optimplotx,@optimplotfunccount,@optimplotfval,..
> @optimplotstepsize,@optimplotfirstorderopt};
>
> My problem is when in the function "callAllOptimPlotFcns" the command
>
> state(i) = feval(plotNames{i},x,optimvalues,'init',varargin{:});
>
> is called, the arguments are more than what e.g. "optimplotx" or other
> functions in PlotFcn are allowed to have! so as a result I get the error:
> ??? Error using ==> optimplotx
> Too many input arguments.
>
> I would appreciate it if anyone can help me with that,

If you're calling the optimization function with additional parameters after
the options structure (the old way to pass additional parameters into the
objective function) then you will need to modify the way you call the plot
functions to accept those additional parameters (even if they don't use
them) or you'll need to use an anonymous function for your objective
function (the new way to pass additional parameters.)

See Q4.13 in the newsgroup FAQ for more information.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ