I have a system of 5 non-linear equations I am trying to solve using fsolve. I'm calling fsolve many times for a bunch of different combinations of initial guesses for each of the 5 variables to see which one produces the most accurate result. I have defined the following initial guess vectors for each variable I am soliving for:
a = gpuArray([a1 a2 ... aN]);
b = gpuArray([b1 b2 ... bN]);
c = gpuArray([c1 c2 ... cN]);
d = gpuArray([d1 d2 ... dN]);
e = gpuArray( [e1 e2 ... eN]);
I then created a grid of initial guesses to solve over:
[aa,bb,cc,dd,ee] = ndgrid(a,b,c,d,e);
Finnally I used arrayfun to compute fsolve over this grid. The function max_Jemit(x, n0, kTe_eV, Vc) is the function containing my 5 equations:
[Solutionsx, Solutions_Val] = arrayfun(@(x01,x02,x03,x04,x05) fsolve(@(x) max_Jemit(x, n0, kTe_eV, Vc), [x01 x02 x03 x04 x05], opts), aa, bb, cc, dd, ee);
I get the following error:
Creating anonymous functions is not supported.
I am assuming it's referring to the line @(x01,x02,x03,x04,x05). However, that seems necessary to keep in so arrayfun knows where to put those arrays. This code works just fine using normal arrays (provided I include 'UniformOut', false). Is there a workaround for this?