Fzero Error, Unbalanced or unexpected parenthesis or bracket

I'm currently trying work with the fzero built in function, but I am constantly being given the error of Unbalanced or unexpected parenthesis or bracket. Below is my code.
fun=@cos;
x0 = [1,2];
x = fzero(fun, x0)
I understand what the error is saying, but I don't see why it's displaying it.

2 件のコメント

Walter Roberson
Walter Roberson 2017 年 7 月 16 日
That code works when I copy and paste it.
Perhaps the error is on some earlier line?
Stephen23
Stephen23 2017 年 7 月 17 日
@Zachary Cutter: please edit your question and show us the complete error message. This means all of the red text.

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2017 年 7 月 17 日

0 投票

Copy all of your code into the MATLAB Editor. In the gutter on the right side of the Editor you should see a red square at the top and a red line somewhere below that. Click on the red line and it should take you to the line of code where MATLAB believes you have an unbalanced or unexpected parenthesis or bracket.

カテゴリ

ヘルプ センター および File ExchangeOptimization についてさらに検索

質問済み:

2017 年 7 月 16 日

回答済み:

2017 年 7 月 17 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by