为什么会弹出这个错误?
我想知道为什么缺少输入参数
我把x的表达式写错了吗?
X的表达式为
我尝试修改x的表达式和flot的范围,但我做不到。
my_function=@(x)my_function((-x.^2)-(5.*x)-3+(exp.^x))
my_function =
function_handle with value:
@(x)my_function((-x.^2)-(5.*x)-3+(exp.^x))
>> fplot(my_function,[-5:5])
Error using fplot
Invalid parameter '-5 -4 -...'.
>> fplot(my_function,[-5 5])
Warning: Error updating FunctionLine.
The following error was reported evaluating the
function in FunctionLine update: Not enough input
arguments.
>> fplot(my_function,[-5,5])
Warning: Error updating FunctionLine.
The following error was reported evaluating the
function in FunctionLine update: Not enough input
arguments.
>> fplot(my_function,[-5,5,1])
Error using fplot
Invalid parameter '-5 5 1'.
>> fplot(my_function,(-5,5))
fplot(my_function,(-5,5))
↑
Invalid expression. When calling a function or indexing
a variable, use parentheses. Otherwise, check for
mismatched delimiters.
>> fplot(my_function,[-5,5])
Warning: Error updating FunctionLine.
The following error was reported evaluating the
function in FunctionLine update: Not enough input
arguments.
The issues to be addressed are:
Use the fplot function to plot the function over the range of x from -5 to +5.
1条答案
按热度按时间monwx1rj1#
exp
不是一个值,它是一个函数,并且您没有提供任何输入(因此出现错误消息)。应将exp.^x
替换为exp(x)