MATLAB: Creating a function in MATLAB

functionhomeworkmatlab function

Here is my question. I feel like this is an easy task but somehow cannot create a function to do this for me.
Create a function which given a value x, returns a value f(x) according the
following equation:
f(x)=xsin(x).
Thanks for the help!

Best Answer

f=@(x) x*sin(x)
%or
function y=f(x)
y=x*sin(x)