在for循环中运行参数化fminsearch的Matlab?
基本上,我想让fminsearch运行在各种各样的数据或参数上 因此,我运行了以下代码片段:在for循环中运行参数化fminsearch的Matlab?,matlab,Matlab,基本上,我想让fminsearch运行在各种各样的数据或参数上 因此,我运行了以下代码片段: %Setting up the changeable WIRX parameters: L = 0.15; %Length along the electrodes in meters I = 3000; %Current in amps %Running the fminsearch: TeNe = fminsearch(@(params) TeNe(params,L,I),[5,1.5e21],o
%Setting up the changeable WIRX parameters:
L = 0.15; %Length along the electrodes in meters
I = 3000; %Current in amps
%Running the fminsearch:
TeNe = fminsearch(@(params) TeNe(params,L,I),[5,1.5e21],optimset('MaxFunEvals', 100000,'MaxIter', 100000));
我想做的是能够在一个for循环中使用L和I的一个值数组来运行它。但是我注意到,我甚至不能在一行中运行这段代码两次而不得到错误:
Subscript indices must either be real positive integers or logicals.
任何见解都将不胜感激 我假设
TeNe
是一个通过以下输入调用的函数:(params,L,I)
但是,的输出也被分配给
TeNe
这就是为什么在第一次循环迭代之后,您会看到错误
L
已设置为0.15
,但是,作为名为TeNe
的数组的索引,这没有任何意义,您在运行fminsearch
后会得到该数组
考虑更改输出变量的名称。< /P>