my problem is about @.

6 ビュー (過去 30 日間)
Sevval Zengin
Sevval Zengin 2022 年 2 月 3 日
コメント済み: Sevval Zengin 2022 年 2 月 3 日
syms x
f=@x x.^2
quad(f,0,2)
System give error that 'Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.'
.....................................................................................................................................................................................................................................
PLEASE HELP ME
  2 件のコメント
Stephen23
Stephen23 2022 年 2 月 3 日
Note that syms does nothing here. Get rid of it.
Sevval Zengin
Sevval Zengin 2022 年 2 月 3 日
Thank you so much Stephen for your answer.

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

採用された回答

Stephen23
Stephen23 2022 年 2 月 3 日
編集済み: Stephen23 2022 年 2 月 3 日
f = @(x) x.^2;
% ^ ^ you forgot these parentheses
q = quad(f,1,2)
q = 2.3333
How to define anonymous functions is explained here:
  1 件のコメント
Sevval Zengin
Sevval Zengin 2022 年 2 月 3 日
Thank you so much

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

その他の回答 (1 件)

Arif Hoq
Arif Hoq 2022 年 2 月 3 日
try it:
syms x
f=@(x) x.^2
f = function_handle with value:
@(x)x.^2
quad(f,0,2)
ans = 2.6667
  2 件のコメント
Stephen23
Stephen23 2022 年 2 月 3 日
Note that syms does nothing here.
Sevval Zengin
Sevval Zengin 2022 年 2 月 3 日
thank youuu so much

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

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by