How do you express this function in MATLAB syntax ?

𝑓(𝑥) = e^x + sin(5x)
How do you express this function in MATLAB syntax ?

 採用された回答

KSSV
KSSV 2020 年 6 月 9 日
編集済み: KSSV 2020 年 6 月 9 日

1 投票

f = exp(x)+sin(5*x) ; % define x before
f = @(x) exp(x)+sin(5*x) ; % call by f(value) This is called Anonymous function

5 件のコメント

Emre Can Usengul
Emre Can Usengul 2020 年 6 月 9 日
Can you type how can I write on MATLAB code. Because I wrote this and I had an error.
KSSV
KSSV 2020 年 6 月 9 日
Show us what you tried...and tell us the error.
Emre Can Usengul
Emre Can Usengul 2020 年 6 月 9 日
f = exp(x)+sin(5*x) ;
f = @(x) exp(x)+sin(5*x) ;
like tihs and there is error.
How can I type it. I want this code.
KSSV
KSSV 2020 年 6 月 9 日
I gave comments...did you folllow those comments?
Walter Roberson
Walter Roberson 2020 年 6 月 9 日
f = exp(x)+sin(5*x) ;
would be an error if you had not defined x before.

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

その他の回答 (0 件)

カテゴリ

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

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by