我一直收到以下错误。
Error in as.vector(x, mode) :
cannot coerce type 'closure' to vector of type 'any'
我想使用RStudio中的matplot选项绘制f2(x)对x。有什么我想念的吗?
f2<-function(x){
if(x>=0){
return(sqrt(x))
}else{
return(sqrt(-x))
}
}
x<- seq(from= -5, to= 5, by= 0.001)
require(graphics)
matplot(f2, x, type = "1", xlab = expression(alpha), ylab = expression(sqrt(abs(alpha))))