[R] Plotting Finite Element and Finite Difference Results together

emorway emorway at usgs.gov
Fri Mar 18 22:17:23 CET 2011


As a simplification of a much larger problem, I'm using the following simple
example to explore ways of getting the finite difference results to plot
over the same extents as the finite element solution (see figure).  I
haven't discovered (if it exist) a way of getting the finite difference data
to extrapolate, perhaps I'm using the wrong plotting tool?

FD.dat<-matrix(c(1,3.5,3.5,1,
                 1,2.5,2.5,1,
                 1,1.5,1.5,1,
                 1,1,1,1),
               nrow=4,ncol=4,byrow=TRUE)

FE.dat<-matrix(c(1,1,4,1,1,
                 1,1,3.5,1,1,
                 1,1,2.5,1,1,
                 1,1,1.5,1,1,
                 1,1,1,1,1),
               nrow=5,ncol=5,byrow=TRUE)

FD.x.coords<-c(0.5,1.5,2.5,3.5)
FE.x.coords<-c(0,1,2,3,4)
FD.y.coords<-FD.x.coords
FE.y.coords<-FE.x.coords

contour(FD.x.coords,FD.y.coords,FD.dat,xlim=c(0,4),ylim=c(0,4))
contour(FE.x.coords,FE.y.coords,FE.dat,xlim=c(0,4),ylim=c(0,4),add=T,col="red")


http://r.789695.n4.nabble.com/file/n3388485/Slide1.png 

--
View this message in context: http://r.789695.n4.nabble.com/Plotting-Finite-Element-and-Finite-Difference-Results-together-tp3388485p3388485.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list