Hi! I need help from someone that knows something about numerical methods in MATLAB. Specifically,(adsbygoogle = window.adsbygoogle || []).push({}); fsolve.

So, I have an equationL = K(x) - F(x,y). Given the values of L and y, I need to determine the value of x numerically.

So, here's what I've done:

G(x) = L- K(x) + F(x,y)

in the function m-file

function [G] = g(x,y,L)

I then need to evaluate G(x) numerically to find the values of x at which G(x) becomes 0. Thats my understanding of numerical determination.

So I use the fsolve command in Matlab this way

[x, fval] = fsolve(@g, x, options);

But the problem is that I need to pass multiple values of y, L and some initial estimate of x (that apparently fsolve requires) to find different values of x for different values of y. Matlab doesnt accept this. i.e. ideally I'd like to do something like

for y=0:0.1:10

[x, fval] = fsolve(@g(x,y,L), x, options);

end

where I can pass multiple values of y and L (array or for-loop) to find the values of x.

Can I do this? or do I need to declare Global variables and access y and L in function g that way?

Also, if I've no idea of what x looks like, how do I estimate an initial value?

Would appreciate your contributions to resolving this.

Thanks.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB numerical evaluation doubt

**Physics Forums | Science Articles, Homework Help, Discussion**