Hello everyone!
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?
Here is the molecule that needs the loop:
L = input('Please enter value of L. [L]: ');
R = input('Please enter value of R. [R]: ');
patch('vertices',[.5*L .5*L 0
.5*L .5*L 0
.5*L .5*L 0
.5*L .5*L 0
sqrt(.5)*R+.5*L .5*L sqrt(.5)*R
sqrt(.5)*R.5*L .5*L sqrt(.5)*R
sqrt(.5)*R.5*L .5*L sqrt(.5)*R
sqrt(.5)*R+.5*L .5*L sqrt(.5)*R
.5*L sqrt(.5)*R+.5*L sqrt(.5)*R
.5*L sqrt(.5)*R.5*L sqrt(.5)*R
.5*L sqrt(.5)*R+.5*L sqrt(.5)*R
.5*L sqrt(.5)*R.5*L sqrt(.5)*R
sqrt(.5)*R.5*L .5*L sqrt(.5)*R+L
sqrt(.5)*R+.5*L .5*L sqrt(.5)*R+L
sqrt(.5)*R.5*L .5*L sqrt(.5)*R+L
sqrt(.5)*R+.5*L .5*L sqrt(.5)*R+L
.5*L sqrt(.5)*R.5*L sqrt(.5)*R+L
.5*L sqrt(.5)*R.5*L sqrt(.5)*R+L
.5*L sqrt(.5)*R+.5*L sqrt(.5)*R+L
.5*L sqrt(.5)*R+.5*L sqrt(.5)*R+L
.5*L .5*L sqrt(2)*R+L
.5*L .5*L sqrt(2)*R+L
.5*L .5*L sqrt(2)*R+L
.5*L .5*L sqrt(2)*R+L
],'faces',[11 9 1 2; 6 11 2 NaN; 13 20 11 6; 21 20 13 NaN
23 21 13 15; 1 9 5 NaN; 9 19 14 5; 19 22 14 NaN; 19 20 21 22
1 5 8 4; 4 8 10 NaN; 3 4 10 12; 7 3 12 NaN; 6 2 3 7; 15 7 12 18
23 15 18 NaN; 24 23 18 17; 8 16 17 10; 17 16 24 NaN
16 14 22 24],'facecolor',[.2 0 .5])
view(3)
rotate3d
axis equal
