Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 3D points representing cubes to 3D surface?
Replies: 3   Last Post: Nov 29, 2012 5:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 8,813
Registered: 7/26/08
Re: 3D points representing cubes to 3D surface?
Posted: Nov 24, 2012 4:12 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Here is a function that build edge topology for any dimension. Using this code we can see the number of edge hypercube in a 13th dimensional space is 53248.

n=3

c = repmat({[0 1]},[1 n]);
[c{:}] = ndgrid(c{:});
c = cat(n+1,c{:});
c = reshape(c,[],n);
[i, d] = ndgrid((1:2^n)',2.^(0:n-1));
j = (1-c) .* (i+d);
b = j>0;
e = [i(b) j(b)];

xyz = c(e',:);
xyz = reshape(xyz, 2, [], n);
xyz = num2cell(xyz,[1 2]);

if n==2
plot(xyz{:});
elseif n==3
plot3(xyz{:});
end

% Bruno



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.