Filter löschen
Filter löschen

Creating a function in MATLAB

2 Ansichten (letzte 30 Tage)
Aaron
Aaron am 2 Feb. 2013
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!

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 2 Feb. 2013
Bearbeitet: Azzi Abdelmalek am 2 Feb. 2013
f=@(x) x*sin(x)
%or
function y=f(x)
y=x*sin(x)

Weitere Antworten (1)

Image Analyst
Image Analyst am 2 Feb. 2013
Is this homework? Did you look up how to define functions in the help? Do you know that you need to use ".*" between the x and the sin?

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by