2017-07-13 31 views

回答

0

當然。只需使用額外fsolve輸出:

[x, fval, exitflag, output] = fsolve(...) 
if exitflag <= 0 
    return 
end 

您可以相應地調整基於documentation

1

概括有這麼fzero返回一個exitflag標誌值的條件。如果不是1,則遇到了一些問題:

https://www.mathworks.com/help/matlab/ref/fzero.html

例如:

func       = @(x) x^2 +1 
[x, fval, exitflag, output]  = fzero(func, 0) 

if exitflag ~= 1 
    disp('no solution was found, terminating further execution'); 
    return 
end 
+0

感謝,快速回復。我接受了另一個答案,因爲它更快一點,對不起。 – PalimPalim

相關問題