Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

problem with drawing graph of sum function in r

$
0
0

Let's take sample 'y' of length 100 from N(0,1) distribution and function g(x)=x^2+7.

I want to make a graph of function $h(x)=\sum_{i=1}^{100}g(x-y[i])$

So

 y=rnorm(100,0,1)

 g=function(x){x^2+7}

h=function(x){sum(g(x-y))}

And now expressions like

curve(h)

plot(h)

lines(h)

doesnt work, can You please help me how can i draw graph of function h?


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>