Creating a function in MATLAB
조회 수: 2 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2013년 2월 2일
편집: Azzi Abdelmalek
2013년 2월 2일
f=@(x) x*sin(x)
%or
function y=f(x)
y=x*sin(x)
댓글 수: 0
추가 답변 (1개)
Image Analyst
2013년 2월 2일
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?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!