【问题标题】:Ploting equation in R [duplicate]在R中绘制方程[重复]
【发布时间】:2019-11-01 13:10:23
【问题描述】:

我使用这些代码来解决 R 中的一个问题。f(a)= |x|+5a-6,其中 |x|。绘制合并的值是否正确。我得到一条直线。

merge <- function(x) {
  y <- abs(a) + 5*(a)-6  
  return(y) 
}

merge (-4.534)

#c. Obtain the graph of the function.

plot (merge) 
merge <- function(x) {
  y <- abs(a) + 5*(a)-6  
  return(y) 
}

merge (-4.534)

#c. Obtain the graph of the function.

plot (merge)

【问题讨论】:

    标签: r


    【解决方案1】:

    你的函数没有价值。你必须提供论据。试试:

    x <- seq(-100, 100)
    merge <- function(a) {
      y <- abs(a) + 5*(a)-6  
      return(y) 
    }
    merge(x)
    plot(x, merge(x))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多