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 - The Fusion of Science and Community**

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

Loading...

Similar Threads - MATLAB numerical evaluation | Date |
---|---|

I don't get a reasonable output for my code? | Mar 18, 2017 |

Matlab Is MATLAB better for numerical simulation | Jan 16, 2017 |

Matlab Finite difference numerical integration or ode45? | May 17, 2016 |

Matlab Numerical integration | May 7, 2016 |

MATLAB numerical evaluation | Feb 19, 2008 |

**Physics Forums - The Fusion of Science and Community**