fsolve for solution != 0
I want to solve an equation for a different value in each cycle of a for loop. I usually include the value that I am solving 开发者_JS百科for in the m-file function but I can't change the m file at each cycle in the for loop. Is there a way to solve the use fsolve but for a value !=0.
You can use an anonymous function. So if your paramterised function is:
function y = f(x, c)
...
end
then you can iterate over different parameters thus:
for c = 0:10
fsolve(@(x)f(x,c), x0);
end
(Untested)
精彩评论