Hi all,
I have written some code in matlab using a primary function that calls fsolve and a subfunction for passing extra arguments to the function being solved.
function out1 = RxCase2(pin1,pin2,pin3,pT,pVpore,options)
global in2 in3 T Vpore
in2=pin2;
in3=pin3;
T=pT;
Vpore=pVpore;
varlogic = logical([1 1 0 1 0 0]);
pin1(varlogic) = feval('fsolve',@NLeqset2,pin1(varlogic),options);
out1 = TotalSol2(pin1);
...
function [out1,out2] = NLeqset2(in1)
global in2 in3 T Vpore
...
function out1 = TotalSol2(in1)
global in2 T Vpore
...
However I get the error 'Function handles cannot be passed to extrinsic functions' when compiling. This function does work as a native matlab function.
I also tried coder.extrinsic('fsolve'), but it seems that I can't pass the function handle to the fsolve() routine. I am running into problems because it seems most ways to pass extra parameters use function handles, fsolve needs to be passed @NLeqset2, and the coder is not compatible with fsolve() (only fzero which works by calling it without feval; i.e something like fzero(@NLeqset,x0)).
Does anyone have any suggestions on how to pass the arguments to the subfunction and pass the subfunction to fsolve() in a way that can be compiled?