[Scilab-users] find a zero of a system of nonlinear functions

Hermes herozigle at gmail.com
Tue Nov 28 11:58:34 CET 2017


I have tried to reproduce what can be read in this document, 
https://ljk.imag.fr/membres/Bernard.Ycart/mel/ds/ds.pdf
<https://ljk.imag.fr/membres/Bernard.Ycart/mel/ds/ds.pdf>  , on page 36.
 I find it interesting to introduce a range as an initial value.
I use  otras funciones y obtuve los resultados esperados.
function y=f(x)
    y=exp(-x.^2)*cos(4*x);
endfunction
function y = B(x)
 y = besselj(40,x+cos(x));
endfunction
I would have liked to replace this script with the fsolve function:

function root=brute_force_root_finder(F, a, b, n)
    x = linspace(a, b, n);
    n=size(x,"*")-1;
    y = feval(x,F);
    root = [];
    for i=1:n-1
        if y(i)*y(i+1) < 0 then
            root($+i) = x(i) - (x(i+1) - x(i))/(y(i+1) - y(i))*y(i);//root =
x[i] - (x[i+1] - x[i])/(y[i+1] - y[i])*y[i]
        end
    end
endfunction
Gracias




--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html



More information about the users mailing list