Numerical function invalid expression
조회 수: 4 (최근 30일)
이전 댓글 표시
I want to defind a function numerically. The function is ((e^2x)*tan(x))/x^3).
I'm using h=@(x)exp(2x).*tan(x)./x.^3 to defind it but it says invalid expression. Please help and thanks in advance.
댓글 수: 0
채택된 답변
the cyclist
2021년 8월 2일
편집: the cyclist
2021년 8월 2일
You need the explicit multiplication sign 2*x:
h=@(x)exp(2*x).*tan(x)./x.^3
You might also want to put in some parentheses instead of relying on the order of operations, to be certain the expression is evaluated in the order you expect.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!