factorialfunction <-function(a,b, n, K){
K*(b^a)*((2+b)^(n+a))
}
Klist = c(1,5,10,50,100,200)
nlist = c(1,5,10,50,100,200)
#note that the n and K values are recycled, make them whatever you wish, they are constants,
#while a and b take on any values, here 100 values between zero and one
res <- mapply(factorialfunction,a = seq(.01,1,by=.01),
b=seq(.01,1,by=.01), n = rep(nlist,each = 100), K=rep(Klist, each=100))
#Then you can plot this six times.
#allow six plots on the panel if you want
par(mfrow = c(3,2))
#loop through different plots
for (i in 1:6)
plot(1:100,res[1:100 + (i-1)*100])
Note In this code I chose a and b to be between zero and one, I am not familiar with this function but It looks like some type of Beta.
You can generate more than 6 plots by changing klist
and nlist
and your par
and for
loop parameters.
Here is what you get, note this code is customizable to produce the plots for the values of n, K, a, and b that you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.