You are on page 1of 4

clc

disp ('Ali Hamza


2008-MECH-118')
disp ('A circular Mesh')
nc=6;
%no of element at the centre
nr=4;
%no of nodal point along horizontal radius
ir=3;
%counter of ring along radius
1<ir<nr-1
r=(ir/(nr-1));
% radius of any circule of elements
a(54,16)=1;
for n=1:54
a(n,1)=n;
end
%************** Generating "r" for i **************
ir=0; nr=4; nc=6;
for bb=1:54
% value of "r" for i
a(bb,5)=(ir/(nr-1));
if (bb==6 || bb==18 || bb==36)
ir=ir+1;
end
if bb==36
ir=1;
end
if bb==42
ir=2;
end
end
%************** Generating "r" for j **************
ir=1; nr=4; nc=6;
for bb=1:54
% value of "r" for
a(bb,9)=(ir/(nr-1));
if (bb==6 || bb==18 || bb==36)
ir=ir+1;
end
if bb==36
ir=2;
end
if bb==42
ir=3;
end
end
%************** Generating "r" for k **************
ir=1; nr=4; nc=6;
for bb=1:54
a(bb,13)=(ir/(nr-1));
if (bb==6 || bb==18 || bb==36)
ir=ir+1;
end
if bb==36
ir=1;
end
if bb==42
ir=2;
end
end
%************** i,j.k and coordinates when r=1 for outward triangles
m=1; it=1;i=1; i1=1; i2=2;
for bb=1:6
a(bb,3)=m+1;

a(bb,4)=m+2;
if rem((it-1),1)==0
i=i;
else
i=i+1;
end
a(bb,2)=i;
a(bb,10)=((2*(i1-1)*180)/(6));
a(bb,14)=((2*(i2-1)*180)/(6));
it=it+1;
if(bb~=6)
i1=i1+1; i2=i2+1;
end
m=m+1;
end
a(6,4)=2;
%************** i,j.k and coordinates when r=2 for outward triangles
m=7; it=1;i=2; io=1; i1=1; i2=2;
for bb=7:18
a(bb,3)=m+1;
a(bb,4)=m+2;
if rem((it-1),2)==0
i=i; io=io;
else
i=i+1; io=io+1;
end
a(bb,2)=i;
a(bb,6)=((2*(io-1)*180)/(6));
a(bb,10)=((2*(i1-1)*180)/(12));
a(bb,14)=((2*(i2-1)*180)/(12));
it=it+1;
if(bb~=18)
i1=i1+1; i2=i2+1;
end
m=m+1;
end
a(18,2)=2; a(18,4)=8;
%************** i,j.k and coordinates when r=3 for inward triangles
m=19; it=1;i=8; io=1; i1=1; i2=2;
for bb=19:36
a(bb,3)=m+1;
a(bb,4)=m+2;
if rem((it-1),3)==0
i=i; io=io;
else
i=i+1; io=io+1;
end
a(bb,6)=((2*(io-1)*180)/(12));
a(bb,10)=((2*(i1-1)*180)/(18));
a(bb,14)=((2*(i2-1)*180)/(18));
a(bb,2)=i;
it=it+1;
if (bb~=36)
i1=i1+1; i2=i2+1;
end
m=m+1;
end

a(36,2)=8; a(36,4)=20;
%************** i,j.k and coordinates when r=2 for outward triangles
m1=36; it=1; m=37;j=9; io=1;i1=2; i2=2;
for bb=37:42
a(bb,2)=m-m1+1;
a(bb,4)=m-m1+2;
a(bb,3)=j;
j=j+2;
a(bb,6)=((2*(io-1)*180)/(6));
a(bb,10)=((2*(i1-1)*180)/(12));
a(bb,14)=((2*(i2-1)*180)/(6));
io=io+1;
if (bb~=42)
i1=i1+2; i2=i2+1;
end
m=m+1; a(42,4)=2;
end
%************** i,j.k and coordinates when r=3 outward triangles
m=43; it=1;j=21; m1=36; io=1; i1=2; i2=2;
for bb=43:54
a(bb,2)=m-m1+1;
a(bb,4)=m-m1+2;
a(bb,3)=j;
if rem((it-1),2)==0
j=j+1; i1=i1+1;
else
j=j+2; i1=i1+2;
end
a(bb,6)=((2*(io-1)*180)/(12));
a(bb,10)=((2*(i1-1)*180)/(18));
a(bb,14)=((2*(i2-1)*180)/(12));
it=it+1;
if (bb~=54)
io=io+1; i2=i2+1;
end
m=m+1; a(54,4)=8;
end
%************** Generating coordinates **************
for bb=1:54
a(bb,7)=(a(bb,5)*cosd(a(bb,6)));
a(bb,8)=(a(bb,5)*sind(a(bb,6)));
a(bb,11)=(a(bb,9)*cosd(a(bb,10)));
a(bb,12)=(a(bb,9)*sind(a(bb,10)));
a(bb,15)=(a(bb,13)*cosd(a(bb,14)));
a(bb,16)=(a(bb,13)*sind(a(bb,14)));
end
%************** Ploting Graph**************
A=[0 1 0; 0 0 1; 1 0 0];
for bb=1:54
AA=[a(bb,7) a(bb,8); a(bb,11) a(bb,12); a(bb,15) a(bb,16)];
gplot(A,AA)
X=a(bb,7);
Y=a(bb,8);
text(X,Y,[' (',num2str(X),' , ',num2str(Y),')']);
X=a(bb,11);
Y=a(bb,12);
text(X,Y,[' (',num2str(X),' , ',num2str(Y),')']);

hold on
end
a
Ali Hamza
2008-MECH-118
A circular Mesh
a =
1.0000
2.0000
3.0000
4.0000
5.0000
6.0000
7.0000
8.0000
9.0000
10.0000
11.0000
12.0000
13.0000
14.0000
15.0000
16.0000
17.0000
18.0000
19.0000
20.0000
21.0000
22.0000
23.0000
24.0000
25.0000
26.0000
27.0000
28.0000
29.0000
30.0000
31.0000
32.0000
33.0000
34.0000
35.0000
36.0000
37.0000
38.0000
39.0000
40.0000
41.0000
42.0000
43.0000
44.0000
45.0000
46.0000
47.0000
48.0000
49.0000
50.0000
51.0000
52.0000
53.0000
54.0000

1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
2.0000
3.0000
3.0000
4.0000
4.0000
5.0000
5.0000
6.0000
6.0000
7.0000
7.0000
2.0000
8.0000
9.0000
10.0000
10.0000
11.0000
12.0000
12.0000
13.0000
14.0000
14.0000
15.0000
16.0000
16.0000
17.0000
18.0000
18.0000
19.0000
8.0000
2.0000
3.0000
4.0000
5.0000
6.0000
7.0000
8.0000
9.0000
10.0000
11.0000
12.0000
13.0000
14.0000
15.0000
16.0000
17.0000
18.0000
19.0000

2.0000
3.0000
4.0000
5.0000
6.0000
7.0000
8.0000
9.0000
10.0000
11.0000
12.0000
13.0000
14.0000
15.0000
16.0000
17.0000
18.0000
19.0000
20.0000
21.0000
22.0000
23.0000
24.0000
25.0000
26.0000
27.0000
28.0000
29.0000
30.0000
31.0000
32.0000
33.0000
34.0000
35.0000
36.0000
37.0000
9.0000
11.0000
13.0000
15.0000
17.0000
19.0000
21.0000
22.0000
24.0000
25.0000
27.0000
28.0000
30.0000
31.0000
33.0000
34.0000
36.0000
37.0000

3.0000
4.0000
5.0000
6.0000
7.0000
2.0000
9.0000
10.0000
11.0000
12.0000
13.0000
14.0000
15.0000
16.0000
17.0000
18.0000
19.0000
8.0000
21.0000
22.0000
23.0000
24.0000
25.0000
26.0000
27.0000
28.0000
29.0000
30.0000
31.0000
32.0000
33.0000
34.0000
35.0000
36.0000
37.0000
20.0000
3.0000
4.0000
5.0000
6.0000
7.0000
2.0000
9.0000
10.0000
11.0000
12.0000
13.0000
14.0000
15.0000
16.0000
17.0000
18.0000
19.0000
8.0000

0
0
0
0
0
0
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667

0
0
0
0
0
0
0
60.0000
60.0000
120.0000
120.0000
180.0000
180.0000
240.0000
240.0000
300.0000
300.0000
360.0000
0
30.0000
60.0000
60.0000
90.0000
120.0000
120.0000
150.0000
180.0000
180.0000
210.0000
240.0000
240.0000
270.0000
300.0000
300.0000
330.0000
360.0000
0
60.0000
120.0000
180.0000
240.0000
300.0000
0
30.0000
60.0000
90.0000
120.0000
150.0000
180.0000
210.0000
240.0000
270.0000
300.0000
330.0000

0
0
0
0
0
0
0.3333
0.1667
0.1667
-0.1667
-0.1667
-0.3333
-0.3333
-0.1667
-0.1667
0.1667
0.1667
0.3333
0.6667
0.5774
0.3333
0.3333
0
-0.3333
-0.3333
-0.5774
-0.6667
-0.6667
-0.5774
-0.3333
-0.3333
0
0.3333
0.3333
0.5774
0.6667
0.3333
0.1667
-0.1667
-0.3333
-0.1667
0.1667
0.6667
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0
0.3333
0.5774

0
0
0
0
0
0
0
0.2887
0.2887
0.2887
0.2887
0
0
-0.2887
-0.2887
-0.2887
-0.2887
0
0
0.3333
0.5774
0.5774
0.6667
0.5774
0.5774
0.3333
0
0
-0.3333
-0.5774
-0.5774
-0.6667
-0.5774
-0.5774
-0.3333
0
0
0.2887
0.2887
0
-0.2887
-0.2887
0
0.3333
0.5774
0.6667
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333

0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000

0
60.0000
120.0000
180.0000
240.0000
300.0000
0
30.0000
60.0000
90.0000
120.0000
150.0000
180.0000
210.0000
240.0000
270.0000
300.0000
330.0000
0
20.0000
40.0000
60.0000
80.0000
100.0000
120.0000
140.0000
160.0000
180.0000
200.0000
220.0000
240.0000
260.0000
280.0000
300.0000
320.0000
340.0000
30.0000
90.0000
150.0000
210.0000
270.0000
330.0000
40.0000
80.0000
100.0000
140.0000
160.0000
200.0000
220.0000
260.0000
280.0000
320.0000
340.0000
380.0000

0.3333
0.1667
-0.1667
-0.3333
-0.1667
0.1667
0.6667
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0
0.3333
0.5774
1.0000
0.9397
0.7660
0.5000
0.1736
-0.1736
-0.5000
-0.7660
-0.9397
-1.0000
-0.9397
-0.7660
-0.5000
-0.1736
0.1736
0.5000
0.7660
0.9397
0.5774
0
-0.5774
-0.5774
0
0.5774
0.7660
0.1736
-0.1736
-0.7660
-0.9397
-0.9397
-0.7660
-0.1736
0.1736
0.7660
0.9397
0.9397

0
0.2887
0.2887
0
-0.2887
-0.2887
0
0.3333
0.5774
0.6667
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0
0.3420
0.6428
0.8660
0.9848
0.9848
0.8660
0.6428
0.3420
0
-0.3420
-0.6428
-0.8660
-0.9848
-0.9848
-0.8660
-0.6428
-0.3420
0.3333
0.6667
0.3333
-0.3333
-0.6667
-0.3333
0.6428
0.9848
0.9848
0.6428
0.3420
-0.3420
-0.6428
-0.9848
-0.9848
-0.6428
-0.3420
0.3420

0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
0.3333
0.3333
0.3333
0.3333
0.3333
0.3333
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667
0.6667

60.0000
120.0000
180.0000
240.0000
300.0000
360.0000
30.0000
60.0000
90.0000
120.0000
150.0000
180.0000
210.0000
240.0000
270.0000
300.0000
330.0000
360.0000
20.0000
40.0000
60.0000
80.0000
100.0000
120.0000
140.0000
160.0000
180.0000
200.0000
220.0000
240.0000
260.0000
280.0000
300.0000
320.0000
340.0000
360.0000
60.0000
120.0000
180.0000
240.0000
300.0000
360.0000
30.0000
60.0000
90.0000
120.0000
150.0000
180.0000
210.0000
240.0000
270.0000
300.0000
330.0000
360.0000

0.1667
-0.1667
-0.3333
-0.1667
0.1667
0.3333
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0
0.3333
0.5774
0.6667
0.9397
0.7660
0.5000
0.1736
-0.1736
-0.5000
-0.7660
-0.9397
-1.0000
-0.9397
-0.7660
-0.5000
-0.1736
0.1736
0.5000
0.7660
0.9397
1.0000
0.1667
-0.1667
-0.3333
-0.1667
0.1667
0.3333
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0
0.3333
0.5774
0.6667

0.2887
0.2887
0
-0.2887
-0.2887
0
0.3333
0.5774
0.6667
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0
0.3420
0.6428
0.8660
0.9848
0.9848
0.8660
0.6428
0.3420
0
-0.3420
-0.6428
-0.8660
-0.9848
-0.9848
-0.8660
-0.6428
-0.3420
0
0.2887
0.2887
0
-0.2887
-0.2887
0
0.3333
0.5774
0.6667
0.5774
0.3333
0
-0.3333
-0.5774
-0.6667
-0.5774
-0.3333
0

You might also like