finding root of a three variable function

19 views (last 30 days)
Luis Isaac
Luis Isaac on 10 Nov 2020
Edited: Stephan on 10 Nov 2020
Dear
I have a function that depends on three variable f(x,y,z) and I would like to find the root of this function near x0,xy0,z0
I tried fzero(f,[x0,y0,z0]) but de not work because the Matlab says "Second argument must be a scalar or vector of length 2"
Is that means that fzero only works for univariate o bivariate functions?
Does exist a build in function to calculate the zeros of a 3D function?
Thanks in advance,

Answers (1)

Stephan
Stephan on 10 Nov 2020
Edited: Stephan on 10 Nov 2020
You can try fsolve:
% example function
% x(1) = x
% x(2) = y
% x(3) = z
fun = @(x) 3*cos(x(1)) - x(2).^1/3 + x(3) - 7
opts = optimoptions('fsolve','Algorithm','Levenberg-Marquardt');
sol = fsolve(fun,[0 0 0],opts)
test = fun(sol)

Categories

Find more on Optimization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!