Bug fminbnd not working
    2 views (last 30 days)
  
       Show older comments
    
    Stephen Wilkerson
 on 20 Jan 2019
  
fplot(@(x) x*(sin(x))^2*cos(x),[-2*pi 2*pi]);
[xMin1 fvalmin1] =  fminbnd('-x*(sin(x))^2*cos(x)', -6, 6)
returns xMin1 = 1.0954
fvalmin1 = -0.3963 
How is this possible, look at the plot?
3 Comments
Accepted Answer
  Walter Roberson
      
      
 on 20 Jan 2019
        No bug. fminbnd is a local minimizer, not a global minimizer. 
3 Comments
  Torsten
      
      
 on 17 Jul 2022
				
      Edited: Torsten
      
      
 on 17 Jul 2022
  
			Since the changes in the x-values are in the order of 1e-6, you must choose a smaller value for TolX:
a=-200; b=-979.8997; c=7.1833e+05; d=24.4232;e=-6.6083;
x1=0; x2=4.1135e-06;
f=@(x)a-(a-b)*cos(c*(x-x1)) + d*e*sin(c*(x-x1))
fplot(f, [x1 x2])
options = optimset('TolX',1e-8);
[xmin, min]=fminbnd(f, x1, x2, options)
More Answers (0)
See Also
Categories
				Find more on Analog Devices ADALM1000 Support from Data Acquisition Toolbox 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!





