Hello,
I have this function :
tr_J = function(x,y)
{
tr_J = (y-x)/(x+y)-(x+y)**2
return(tr_J)
}
And I want to draw a 3D plot with persp :
require(grDevices)
x <- seq(0, 0.15, length= 100)
y <- x
z <- outer(x,y,tr_J)
res <- persp(x, y, z, theta = 90, phi = 10, expand = 0.5, col = "pink",
xlab = "a", ylab = "b", zlab = "trace(J)",
ticktype = "detailed", font.axis=1)
res
lines(trans3d(x,y,z=0, pmat=res), col = 3)
Then, I define new variables :
alpha = seq(0, 0.15, length= 100)
beta = (1 - alpha)/((alpha + 1)**3)
b = beta
a = alpha * beta
And I'd like to draw this line on my plot :
lines (trans3d(x=a, y=b, z, pmat=res), col = 3)
Problem : it prints :
Error in cbind(x, y, z, 1, deparse.level = 0L) %*% pmat :
arguments inadéquats
Where is the problem ?
What sould I change ?
Thank you for your help