How do you express this function in MATLAB syntax ?

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

Accepted Answer

KSSV
KSSV on 9 Jun 2020
Edited: KSSV on 9 Jun 2020
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 Comments
KSSV
KSSV on 9 Jun 2020
I gave comments...did you folllow those comments?
Walter Roberson
Walter Roberson on 9 Jun 2020
f = exp(x)+sin(5*x) ;
would be an error if you had not defined x before.

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!