It says Fzero isn't a function (SUPER SIMPLE CODE)

S=3*sin(Y)+Y-2;
L=sqrt(1+S.^2);
quiver(T, Y, 1./L, S./L, 0.5);
axis tight
xlabel 't'
ylabel 'y'
title ('DF dy/dt = 3sin(y)+y-2)')
u=fzero(S,.5);
q=fzero(S,4);
My problem is that I'm getting an error with fzero @ the last two lines, but clearly S is a function. I looked through the fzero help table and couldn't figure out why Matlab doesn't see S a a function

1 件のコメント

Adam
Adam 2017 年 2 月 24 日
What you created is just a variable that evaluates a function in-place, not a function itself.

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

回答 (1 件)

Torsten
Torsten 2017 年 2 月 24 日

0 投票

S=@(Y) 3*sin(Y)+Y-2;
Best wishes
Torsten.

カテゴリ

ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索

タグ

質問済み:

2017 年 2 月 24 日

編集済み:

2017 年 2 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by