I want to superimpose two functions plots in the same page. The functions L0 and L1, defined below f0 <- function(mu, xm, ds, n) { 1 - pnorm((xm-mu)/(ds/sqrt(n))) } f1 <- function(mu,n) f0(mu, 386.8, 48, n) L0 <- function(mu) f1(mu, 36) plot(L0,ylim=c(0,1),xlim=c(360,420)) L1 <- function(mu) f1(mu,100) lines(L1) The plot of L0 works pretty well. However, when trying to plot the second function, L1, the interpreter issues an error: Error in as.double(y) : cannot coerce type 'closure' to vector of type 'double' How can I solve my problem, since I want to have both plots with the same quality? I mean, I don't want to produce an approximating polygonal for the second function. Thanks, -Sergio.
On 13-04-03 7:35 PM, Julio Sergio wrote:> I want to superimpose two functions plots in the same page. The functions L0 > and L1, defined below > > > f0 <- function(mu, xm, ds, n) { > 1 - pnorm((xm-mu)/(ds/sqrt(n))) > } > > f1 <- function(mu,n) f0(mu, 386.8, 48, n) > > L0 <- function(mu) f1(mu, 36) > > plot(L0,ylim=c(0,1),xlim=c(360,420)) > > L1 <- function(mu) f1(mu,100) > lines(L1) > > The plot of L0 works pretty well. However, when trying to plot the second > function, L1, the interpreter issues an error: > > Error in as.double(y) : > cannot coerce type 'closure' to vector of type 'double' > > How can I solve my problem, since I want to have both plots with the same > quality? I mean, I don't want to produce an approximating polygonal for the > second function. >curve(L1, add=TRUE) should handle it. Duncan Murdoch
Maybe Matching Threads
- Plotting several functions in the same display (again)
- Re: Nested KVM: L0 guest produces kernel BUG on wakeup from managed save (while a nested VM is running)
- [LLVMdev] Why is the loop vectorizer not working on my function?
- Nested KVM: L0 guest produces kernel BUG on wakeup from managed save (while a nested VM is running)
- [LLVMdev] Why is the loop vectorizer not working on my function?