如何用R中的参数绘制函数

时间:2015-06-10 16:31:28

标签: r plot

我想多次绘制一个函数,每次都更改函数中的参数(常量)。我怎么能这样做?

fun1 <- function(x, b) abs(x^2 - b^2)

plot(fun1(b=0.1),-1, 1)

plot(fun1(b=0.2),-1, 1, add=TRUE)

2 个答案:

答案 0 :(得分:2)

相同的方法只是在var dataString = $('#Form_Name').serializeArray(); txtCalrev_list = ''; $.each(dataString, function (i, field) { if (field.name.indexOf('txt') == 0) txtCalrev_list = txtCalrev_list + (field.value + "_" + field.name + ","); }); alert(txtCalrev_list);

中推广
for-loop

答案 1 :(得分:1)

试试这个:

curve(abs(x^2 - 0.1^2), -1, 1)
curve(abs(x^2 - 0.2^2), -1, 1, add = TRUE)