怎样使MATLAB的fsolve函数不输出提示信息?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎样使MATLAB的fsolve函数不输出提示信息?相关的知识,希望对你有一定的参考价值。

用fsolve函数成功求解方程或方程组后,总会输出一行文字: Optimization terminated: first-order optimality is less than options.TolFun. 当有多次循环求解时,输出满屏幕的 Optimization terminated: first-order optimality is less than options.TolFun. Optimization terminated: first-order optimality is less than options.TolFun. Optimization terminated: first-order optimality is less than options.TolFun. Optimization terminated: first-order optimality is less than options.TolFun. Optimization terminated: first-order optimality is less than options.TolFun. Optimization terminated: first-order optimality is less than options.TolFun. Optimization terminated: first-order optimality is less than options.TolFun. 。。。。。。 怎样去除?

参考技术A 输入以下代码,:
opt=optimset('Display',off)
调用fsolve时,后面一个参数输入opt
你试试看,就是设置这些内容,你可以help一下optimset
祝愿朋友好运!!!

Matlab:fsolve No solution found.

代码:

clear
M = 600;N = 420;p=200;q=2282;
eq = @(x) x^M-(1+q/p)*x^(M-N)+q/p;
options = optimset(MaxFunEvals,10000,MaxIter,1000);
x=fsolve(eq,1.2345,options);
r=1-x

问题描述:

No solution found.

fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared, but the vector of function values
is not near zero as measured by the default value of the function tolerance.

<stopping criteria details>

问题解决:

在命令行窗口键入x

得到 x 1.2114

修改原代码x初值为1.2114

运行,就Equation solved.

 

这个问题应该是迭代的原因,即越来越靠近正确答案。

以上是关于怎样使MATLAB的fsolve函数不输出提示信息?的主要内容,如果未能解决你的问题,请参考以下文章

matlab中如何才能编一个多元函数文件使其既能被ode解微分方程,又能被fsolve解代数方程?

MATLAB用fsolve解方程

请教,Matlab的fsolve函数怎么用

matlab fsolve函数应用

matlab fsolve函数应用

MATLAB fsolve函数调用