fsolve
    15 views (last 30 days)
  
       Show older comments
    
Is there a way to accelerate the fsolve function, with the least lost of precision possible. In:
beta(n+1)=fsolve(F,beta(n))
6 Comments
Accepted Answer
  Sean de Wolski
      
      
 on 17 Jun 2011
        preallocate beta
beta = zeros(nmax+1,1);
beta(1) = beta_of_1;
for ii = 1:nmax
 beta(ii+1) = fsolve(F,beta(ii));
end
EDIT more stuff:
You calculate:
- 'sqrt((Ko^2-(x)^2))*b': 4x
- 'sqrt((Ko^2*Ed-(x)^2))*a': 4x
- the bessel functions multiple times a pop.
Turn your function handle into a function. Make each of these calculations once, then use them multiple times.
More Answers (1)
  Walter Roberson
      
      
 on 17 Jun 2011
        fsolve() can be much faster if you can constrain the range to search in.
2 Comments
  Walter Roberson
      
      
 on 20 Jun 2011
				Sorry it turns out that fsolve() has no way of constraining ranges. fzero() can operate over an interval, if your function has only one independent variable.
See Also
Categories
				Find more on Linear Algebra 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!


