Numerical function invalid expression

1 次查看(过去 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.

采纳的回答

the cyclist
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
h = function_handle with value:
@(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 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by