Displaying 2 results from an estimated 2 matches for "matdistances".
2008 Feb 03
1
distances between points in R^3
...[,2]) * sin(pc[,1])
> z<- r* cos(pc[,2])
>
> plot3d(x, y, z, col=rainbow(1000), size=2,zlim=c(-1,1)) #
> scatterplot of points on a sphere
>
> df<- unique(rbind(x,y,z), MARGIN = 2 ) # removes duplicates in
> cartesian coordinates
> dimension <- dim(df)[1]
> matDistances <- array(data=0,dim=c(dimension,dimension))
>
> norm <- function(a) sqrt(a %*% a)
>
> for (ii in 1:dimension){
> for (jj in ii:dimension){
> matDistances[ii,jj]<- norm( df[,ii] - df[,jj])
> }
> }
This is both inefficient and ugly, I'll welcome any suggestion....
2005 Jan 30
1
New user...tips for spdep
[This email is either empty or too large to be displayed at this time]