MATLAB: How to solve an equation which has another function in it

equationsolve

Hi everyone,
I am trying to solve an equation like
4*x+g(x)=18 where g(x)=2*x+6
meaning that g(x) changes with iterations. I am trying to use solve function, couldn't figure it out.
thanks in advance

Best Answer

Not really sure what you want.
Try this:
g = @(x) 2.*x + 6;
f = @(x) 4.*x + g(x) - 18;
s = fzero(f, 1)