fsolve
조회 수: 19 (최근 30일)
이전 댓글 표시
Is there a way to accelerate the fsolve function, with the least lost of precision possible. In:
beta(n+1)=fsolve(F,beta(n))
채택된 답변
Sean de Wolski
2011년 6월 17일
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.
추가 답변 (1개)
Walter Roberson
2011년 6월 17일
fsolve() can be much faster if you can constrain the range to search in.
댓글 수: 2
Walter Roberson
2011년 6월 20일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!