MATLAB: Fsolve with an evolution parameter

fsolve

How can I add an evolution parameter into a function in prior to use fsolve?
For example, if my function is
function F = myfun(x)
F2 = [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];
end
and I can simply use fsolve by this (according to the documentation),
x0 = [-5; -5];
options = optimoptions('fsolve','Display','iter');
[x,fval] = fsolve(@myfun,x0,options)
However, instead of '2' in the second equation, I would like to change it into a parameter a(t),
F2 = [2*x(1) - x(2) - exp(-x(1));
-x(1) + a*x(2) - exp(-x(2))];
where the value of a(t) is updated in a loop of 't'
The function now is
function F = myfun(x,a)
F = [2*x(1) - x(2) - exp(-x(1));
-x(1) + a*x(2) - exp(-x(2))];
end
where I cannot either update 'a' or use the fsolve anymore
Is there any way out without having to write an explicit solver?
Any helps are appreciated,
Mate

Best Answer

This will allow you to pass in a value for a through fsolve.
[x,fval] = fsolve(@(x) myfun(x,a),x0,options)