Skip to content
Prev 135840 / 398498 Next

how to plot an user-defined function

Your function 'll' only returns a single value when passed a vector:
[1] -7.571559


'plot' expects to pass a vector to the function and have it return a
vector of the same length; e.g.,
[1] 0.00000000 0.09983342 0.19866933 0.29552021 0.38941834 0.47942554
0.56464247 0.64421769 0.71735609
[10] 0.78332691 0.84147098 0.89120736 0.93203909 0.96355819 0.98544973
0.99749499 0.99957360 0.99166481
[19] 0.97384763 0.94630009 0.90929743
So you either have to rewrite your function, or have a loop that will
evaluate the function at each individual point and then plot it.
On Feb 5, 2008 7:06 PM, John Smith <zmring at gmail.com> wrote: