How would I use fzeros in this?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi I want to use fzeros, but I'm not sure what to do to make it work in my code. You can probably understand what I'm trying to do, so I won't explain. Thank you
f = @myFunction
n = -6:6
x0 = n*pi
z = fzero(f, x0)
2 件のコメント
M
2017 年 12 月 8 日
x = fzero(fun,x0) tries to find a point x where fun(x) = 0
How is myFunction defined ?
回答 (1 件)
M
2017 年 12 月 8 日
If you read the documentation, you should have notice that second input argument must be a scalar or a 2-elements vector.
This is not the case with your example.
Try with
f = @myFunction
x0 =[1 -1];
z = fzero(f, x0);
myFunction(z)
ans =
-4.4409e-16
or
f = @myFunction
x0=0;
z = fzero(f, x0);
myFunction(z)
ans =
0
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!