[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Plotting triangulation on a surface using trisurf
From: |
lukshuntim |
Subject: |
Plotting triangulation on a surface using trisurf |
Date: |
Sun, 22 Dec 2013 17:46:02 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
Hi,
It seems trisurf can also be used for plotting the triangulation on a
surface. Here's a working example script which plots the function u = z
on the triangulation on the surface of a sphere. I don't know enough
about the patch function to say for sure that it will always work,
though. The documentation and the demos don't seem to say anything on
this usage.
tri = [
6 39 40
6 40 41
6 41 42
6 42 39
5 35 38
5 37 38
5 37 36
5 36 35
10 22 44
13 26 56
16 30 62
18 34 50
9 21 47
15 29 61
15 29 57
12 25 45
13 46 26
16 58 30
18 64 34
10 48 22
17 49 33
17 63 33
12 55 25
9 43 21
7 46 44
11 58 56
14 64 62
8 48 50
8 49 47
14 63 61
11 55 57
7 43 45
39 10 53
40 13 60
41 16 66
42 18 54
35 9 52
37 15 65
37 15 59
36 12 51
22 1 19
26 2 24
30 3 28
34 4 31
21 1 20
29 3 28
29 3 27
25 2 23
46 7 23
58 11 27
64 14 32
48 8 20
49 8 31
63 14 32
55 11 24
43 7 19
46 13 53
58 16 60
64 18 66
48 10 54
49 17 52
63 17 65
55 12 59
43 9 51
40 53 13
41 60 16
42 66 18
39 54 10
38 52 17
38 65 17
36 59 12
35 51 9
44 19 7
56 24 11
62 28 14
50 31 8
47 20 8
61 28 14
57 27 11
45 23 7
26 23 2
30 27 3
34 32 4
22 20 1
33 31 4
33 32 4
25 24 2
21 19 1
44 53 10
56 60 13
62 66 16
50 54 18
47 52 9
61 65 15
57 59 15
45 51 12
53 40 39
60 41 40
66 42 41
54 39 42
52 38 35
65 38 37
59 36 37
51 35 36
19 44 22
24 56 26
28 62 30
31 50 34
20 47 21
28 61 29
27 57 29
23 45 25
23 26 46
27 30 58
32 34 64
20 22 48
31 33 49
32 33 63
24 25 55
19 21 43
53 44 46
60 56 58
66 62 64
54 50 48
52 47 49
65 61 63
59 57 55
51 45 43
];
coord = [
1.00000 0.00000 0.00000
0.00000 1.00000 0.00000
-1.00000 0.00000 0.00000
0.00000 -1.00000 0.00000
0.00000 0.00000 1.00000
0.00000 0.00000 -1.00000
0.70711 0.70711 0.00000
0.70711 -0.70711 0.00000
0.70711 0.00000 0.70711
0.70711 0.00000 -0.70711
-0.70711 0.70711 0.00000
0.00000 0.70711 0.70711
0.00000 0.70711 -0.70711
-0.70711 -0.70711 0.00000
-0.70711 0.00000 0.70711
-0.70711 0.00000 -0.70711
0.00000 -0.70711 0.70711
0.00000 -0.70711 -0.70711
0.94868 0.31623 0.00000
0.94868 -0.31623 0.00000
0.94868 0.00000 0.31623
0.94868 0.00000 -0.31623
0.31623 0.94868 0.00000
-0.31623 0.94868 0.00000
0.00000 0.94868 0.31623
0.00000 0.94868 -0.31623
-0.94868 0.31623 0.00000
-0.94868 -0.31623 0.00000
-0.94868 0.00000 0.31623
-0.94868 0.00000 -0.31623
0.31623 -0.94868 0.00000
-0.31623 -0.94868 0.00000
0.00000 -0.94868 0.31623
0.00000 -0.94868 -0.31623
0.31623 0.00000 0.94868
0.00000 0.31623 0.94868
-0.31623 0.00000 0.94868
0.00000 -0.31623 0.94868
0.31623 0.00000 -0.94868
0.00000 0.31623 -0.94868
-0.31623 0.00000 -0.94868
0.00000 -0.31623 -0.94868
0.81650 0.40825 0.40825
0.81650 0.40825 -0.40825
0.40825 0.81650 0.40825
0.40825 0.81650 -0.40825
0.81650 -0.40825 0.40825
0.81650 -0.40825 -0.40825
0.40825 -0.81650 0.40825
0.40825 -0.81650 -0.40825
0.40825 0.40825 0.81650
0.40825 -0.40825 0.81650
0.40825 0.40825 -0.81650
0.40825 -0.40825 -0.81650
-0.40825 0.81650 0.40825
-0.40825 0.81650 -0.40825
-0.81650 0.40825 0.40825
-0.81650 0.40825 -0.40825
-0.40825 0.40825 0.81650
-0.40825 0.40825 -0.81650
-0.81650 -0.40825 0.40825
-0.81650 -0.40825 -0.40825
-0.40825 -0.81650 0.40825
-0.40825 -0.81650 -0.40825
-0.40825 -0.40825 0.81650
-0.40825 -0.40825 -0.81650
];
trisurf (tri, coord(:, 1), coord(:, 2), coord(:, 3), coord(:,3),
'facecolor', 'interp', 'edgecolor', 'k' );
colorbar;
axis equal;
xlabel ('x'); ylabel ('y'); zlabel ('z');
title ('Function u = z on surface of sphere');
Regards,
ST
--
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Plotting triangulation on a surface using trisurf,
lukshuntim <=