MATLAB: Fzero use with offset

functionfzerooffsetroot

Hi,
is it possible to make an offset with fzero?
I have a function where I found the root with fzero. Now I want to use the same function but with an offset and let fzero compute the root of the function + offset.
Is this possible somehow?
Thank you for your help.

Best Answer

>> fun = @(x) x^2;
>> ofs = 3;
>> z = fzero(@(x)fun(x)-ofs,1)
z = 1.7321
and confirm that the function value is (almost) zero:
>> fun(z)-ofs
ans = -3.9968e-015
>> fun(z)
ans = 3.0000