1

I've used the following to plot a Weibull distribution W(2,3):

Weibull=function(x){
(2*x/9)*exp(-(x^2)/9)
}
xx=seq(from=0,to=10,length.out=1000)
xx1=Weibull(xx)
plot(xx,xx1,type="l")
polygon(xx, xx1, col = "red", border = NA)

PDF plot

I want to shade the region between (4,10) only. How would I go about doing this?

pogibas
  • 27,303
  • 19
  • 84
  • 117
Ali
  • 1,048
  • 8
  • 19

1 Answers1

2
xx2=seq(from=4,to=10,length.out=1000)
yy2=c(Weibull(xx2),0)
xx2=c(xx2,4)
plot(xx,xx1,type="l")
polygon(xx2, yy2, col = "red", border = NA)

Weibull

G5W
  • 36,531
  • 10
  • 47
  • 80