<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/284777</link>
    <title>MATLAB Central Newsreader - repeating molecules loop</title>
    <description>Feed for thread: repeating molecules loop</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.nl/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 16 Jun 2010 20:51:05 +0000</pubDate>
      <title>repeating molecules loop</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/284777#755048</link>
      <author>Mohammad </author>
      <description>Hello everyone!&lt;br&gt;
&lt;br&gt;
So I made a 3D image of a molecule in MATLAB, but I need to bond many of these molecules together to test the strength of a material composed of these molecules. Each molecule contains 8 rectangular edges, which bond to rectangular edges on other molecules. Therefore each molecule attaches to 8 other molecules to form a fill/gap checkered material. The distance between each molecule is L, while the width of the molecule is L+sqrt(2)*R, making the distance between a coordinate of one molecule and the same coordinate in another molecule 2*L+R*sqrt(2). I've tried to create a loop for this, but it's pretty hard. Could anyone help me?&lt;br&gt;
&lt;br&gt;
Here is the molecule that needs the loop:&lt;br&gt;
&lt;br&gt;
L = input('Please enter value of L. [L]: ');&lt;br&gt;
R = input('Please enter value of R. [R]: ');&lt;br&gt;
&lt;br&gt;
patch('vertices',[.5*L .5*L 0&lt;br&gt;
-.5*L .5*L 0&lt;br&gt;
-.5*L -.5*L 0&lt;br&gt;
.5*L -.5*L 0&lt;br&gt;
sqrt(.5)*R+.5*L .5*L sqrt(.5)*R&lt;br&gt;
-sqrt(.5)*R-.5*L .5*L sqrt(.5)*R&lt;br&gt;
-sqrt(.5)*R-.5*L -.5*L sqrt(.5)*R&lt;br&gt;
sqrt(.5)*R+.5*L -.5*L sqrt(.5)*R&lt;br&gt;
.5*L sqrt(.5)*R+.5*L sqrt(.5)*R&lt;br&gt;
.5*L -sqrt(.5)*R-.5*L sqrt(.5)*R&lt;br&gt;
-.5*L sqrt(.5)*R+.5*L sqrt(.5)*R&lt;br&gt;
-.5*L -sqrt(.5)*R-.5*L sqrt(.5)*R&lt;br&gt;
-sqrt(.5)*R-.5*L .5*L sqrt(.5)*R+L&lt;br&gt;
sqrt(.5)*R+.5*L .5*L sqrt(.5)*R+L&lt;br&gt;
-sqrt(.5)*R-.5*L -.5*L sqrt(.5)*R+L&lt;br&gt;
sqrt(.5)*R+.5*L -.5*L sqrt(.5)*R+L&lt;br&gt;
.5*L -sqrt(.5)*R-.5*L sqrt(.5)*R+L&lt;br&gt;
-.5*L -sqrt(.5)*R-.5*L sqrt(.5)*R+L&lt;br&gt;
.5*L sqrt(.5)*R+.5*L sqrt(.5)*R+L&lt;br&gt;
-.5*L sqrt(.5)*R+.5*L sqrt(.5)*R+L&lt;br&gt;
-.5*L .5*L sqrt(2)*R+L&lt;br&gt;
.5*L .5*L sqrt(2)*R+L&lt;br&gt;
-.5*L -.5*L sqrt(2)*R+L&lt;br&gt;
.5*L -.5*L sqrt(2)*R+L&lt;br&gt;
],'faces',[11 9 1 2; 6 11 2 NaN; 13 20 11 6; 21 20 13 NaN&lt;br&gt;
23 21 13 15; 1 9 5 NaN; 9 19 14 5; 19 22 14 NaN; 19 20 21 22&lt;br&gt;
1 5 8 4; 4 8 10 NaN; 3 4 10 12; 7 3 12 NaN; 6 2 3 7; 15 7 12 18&lt;br&gt;
23 15 18 NaN; 24 23 18 17; 8 16 17 10; 17 16 24 NaN&lt;br&gt;
16 14 22 24],'facecolor',[.2 0 .5])&lt;br&gt;
view(3)&lt;br&gt;
rotate3d&lt;br&gt;
axis equal</description>
    </item>
  </channel>
</rss>
