From: Nathan Zhang on 27 Feb 2010 04:53 I tried to find a solution of nonlinear equation. the following is the m file: function F=find_omega_c(w) U0=4*pi*10^(-7);Ud=U0;E0=8.854*10^(-12);Ed=2.56*E0;b=0.01016;h=b/3; F=sqrt(E0/U0)*cot(w*sqrt(U0*E0)*(b-h))+sqrt(Ed/Ud)*cot(w*sqrt(Ud*Ed)*h); And then I tried to solve the equation: fsolve('find_omega_c',[7.93e+10]) Optimization terminated: first-order optimality is less than options.TolFun. ans = 7.9300e+10 Since it said *less*, I changed the value of Tolfun smaller: fsolve('find_omega_c',[7.93e+10],optimset('TolFun',1e-30)) Optimizer appears to be converging to a point which is not a root. Relative function value changing by less than max(options.TolFun^2,eps) but sum-of-squares of function values is greater than or equal to sqrt(options.TolFun) Try again with a new starting guess. ans = 7.9300e+10 Why its still not working??? The initial guess I set is the 1st order solution, I know the result at first. But I need to find the second and third, why its terminated??? I am appreciate for your reply, thank you!
From: Rune Allnor on 27 Feb 2010 06:24 On 27 Feb, 10:53, "Nathan Zhang" <hj_zha...(a)tom.com> wrote: > I tried to find a solution of nonlinear equation. .... > Why its still not working??? The initial guess I set is the 1st order solution, I know the result at first. But I need to find the second and third, why its terminated??? Numerical solvers have a number of safeguards built in to them: 1) Iterative solvers have a maximum number of allowed iterations 2) There are limits to improvement of the objective functions 3) There are limits to the update of the argument Conevergence tests are performed to see if 'sufficient' improvements to the solutions are made per iteration (the actual test might monitor progress over more than one iteration). If the test fails, it means that the solver has reached a dead end, and terminates instead of keep crunching numbers that will not get it anywhere. As for a solver being able to find several solutions of a non-linear problem - that's hard. There are no guarantees that a general-purpose solver will even find *a* solution; let alone more than one. You might be able to come up with special-purpose solvers that are tailored to either your application or equation, but that's a speciality that requires quite a bit of insights into both the problem and numerics. Rune
From: Nathan Zhang on 27 Feb 2010 15:32 Thanks for your reply. In my case, how to fix it?? I think there must be an easy way to solve the problem, since it is just a simple trigonometric functions with only one unknown. Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <893853d7-689a-4124-9251-ef933e73b677(a)v20g2000yqv.googlegroups.com>... > On 27 Feb, 10:53, "Nathan Zhang" <hj_zha...(a)tom.com> wrote: > > I tried to find a solution of nonlinear equation. > ... > > Why its still not working??? The initial guess I set is the 1st order solution, I know the result at first. But I need to find the second and third, why its terminated??? > > Numerical solvers have a number of safeguards built in > to them: > > 1) Iterative solvers have a maximum number of allowed iterations > 2) There are limits to improvement of the objective functions > 3) There are limits to the update of the argument > > Conevergence tests are performed to see if 'sufficient' > improvements to the solutions are made per iteration (the > actual test might monitor progress over more than one > iteration). If the test fails, it means that the solver > has reached a dead end, and terminates instead of keep > crunching numbers that will not get it anywhere. > > As for a solver being able to find several solutions of a > non-linear problem - that's hard. There are no guarantees > that a general-purpose solver will even find *a* solution; > let alone more than one. > > You might be able to come up with special-purpose solvers > that are tailored to either your application or equation, > but that's a speciality that requires quite a bit of > insights into both the problem and numerics. > > Rune
From: Rune Allnor on 27 Feb 2010 15:40 On 27 Feb, 21:32, "Nathan Zhang" <hj_zha...(a)tom.com> wrote: > Thanks for your reply. > > In my case, how to fix it?? I think there must be an easy way to solve the problem, since it is just a simple trigonometric functions with only one unknown. Try and write a program that finds *all* the solutions of sin(x) = 0. Rune
From: Steven Lord on 1 Mar 2010 00:23 "Nathan Zhang" <hj_zhangs(a)tom.com> wrote in message news:hmaq21$lll$1(a)fred.mathworks.com... >I tried to find a solution of nonlinear equation. > > the following is the m file: *snip* > And then I tried to solve the equation: > > > fsolve('find_omega_c',[7.93e+10]) > Optimization terminated: first-order optimality is less than > options.TolFun. The word "terminated" here does NOT mean it failed; it simply means the optimization has ended. The latter part of the message indicates _why_ the optimization ended. If I remember correctly, that message means it finished successfully; you can check this by calling FSOLVE and specifying two outputs (to receive the EXITFLAG output) whose meaning should be described in the M-file help or documentation page. I believe our documentation staff is working to improve and/or has improved in recent releases the messages that appear when an optimization completes. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: simulation of energy detection over fading channels Next: random selection of test files |