Duncan and David, thank you so much.
You are right. We can use
z1 <- outer(x, y, function(x,y) x^2+3*y^2)
rather than
xy <- meshgrid(x,y)
z2 <- xy$x^2+ 3*xy$y^2
to get right answer. I run these codes on my computer and found that z2 is
the transpose of z1.
So I guess in order to obtain
On Aug 11, 2010, at 11:16 AM, ba ba wrote:
Dear All,
I tried to plot contour lines using R function contour, but got the
results
which are not expected.
require(RTOMO)
x <- seq(-1,1,0.1)
y <- seq(-1,1,0.1)
xy <- meshgrid(x,y)
z <- xy$x^2+ 3*xy$y^2
contour(x,y,z,col="blue",xlab="x",ylab="y
On 11/08/2010 11:16 AM, ba ba wrote:
Dear All,
I tried to plot contour lines using R function contour, but got the results
which are not expected.
require(RTOMO)
x <- seq(-1,1,0.1)
y <- seq(-1,1,0.1)
xy <- meshgrid(x,y)
z <- xy$x^2+ 3*xy$y^2
contour(x,y,z,col="blue",xlab="x",ylab="y")
The abo
Dear All,
I tried to plot contour lines using R function contour, but got the results
which are not expected.
require(RTOMO)
x <- seq(-1,1,0.1)
y <- seq(-1,1,0.1)
xy <- meshgrid(x,y)
z <- xy$x^2+ 3*xy$y^2
contour(x,y,z,col="blue",xlab="x",ylab="y")
The above code gave me the contour graph for z
4 matches
Mail list logo