how to define a function in the command window using "@"

I have seen this before but I can't remember. Can someone give an example? Thanks.

 採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 3 月 7 日

0 投票

please read here
eg
>> f = @(x)x.^2-3
f(54)
f =
@(x)x.^2-3
ans =
2913

2 件のコメント

Amjith Shaheer
Amjith Shaheer 2020 年 7 月 1 日
Can this be done (@x) sin(x)-exp(-x)
Steven Lord
Steven Lord 2020 年 7 月 1 日
Moving the first left parenthesis to its proper place, sure.
f = @(x) sin(x)-exp(-x);
f(-1:0.25:1)

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

その他の回答 (0 件)

カテゴリ

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

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by