-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplottingScripts.m
More file actions
117 lines (105 loc) · 2.62 KB
/
Copy pathplottingScripts.m
File metadata and controls
117 lines (105 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
% Plot Weight Function(Box):
a=3;
xI=[0,0];
[X,Y]=meshgrid(0:0.08:10,0:0.08:2);
Z=zeros(size(X,1));
W=Weight(xI,a,0);
for i=1:size(X,1) % Columns
for j=1:size(Y,2) % Rows
Z(i,j)=W.w([X(i,j);Y(i,j)]);
end
end
surf(X,Y,Z)
%% Point on Shape Function Derivative:
a=1;
xI=[0,0];
W=Weight(xI,a,0);
z=W.wx([-0.5;-0.5])
%% Plot Weight Function Derivative(Box):
a=1;
xI=[0,0];
[X,Y]=meshgrid(-1:0.1:1);
Z=zeros(size(X,1));
W=Weight(xI,a,0);
for i=1:size(X,1) % Columns
for j=1:size(Y,2) % Rows
z=W.wx([X(i,j);Y(i,j)]);
Z(i,j)=z(2);
end
end
surf(X,Y,Z)
%% Plot Shape Function
figure(1)
shape=10;
[X,Y]=meshgrid(0:0.1:10,0:0.1:2);
Z=zeros(size(X,1));
for i=1:size(X,1) % Columns
for j=1:size(Y,2) % Rows
Z(i,j)=PointCloud.Nodes(shape).sF.getValue([X(i,j);Y(i,j)]);
end
end
surf(X,Y,Z,'facecolor','blue','EdgeColor','blue')
alpha(0.1)
hold on
for i=1:PointCloud.numberOfNodes
scatter(PointCloud.Nodes(i).cordinates(1),PointCloud.Nodes(i).cordinates(2),'ko','filled')
hold on
end
scatter(PointCloud.Nodes(shape).cordinates(1),PointCloud.Nodes(shape).cordinates(2),'r+')
%% Test PU:
xTest=Mesh.Elements(1).getIntCord(1);
pu=0;
for i=1:PointCloud.numberOfNodes
pu=pu+PointCloud.Nodes(i).sF.getValue([xTest(1);xTest(2)]);
end
pu-1
%% Test NU:
xTest=Mesh.Elements(1).getIntCord(1);
nu1=0;
nu2=0;
for i=1:PointCloud.numberOfNodes
temp=PointCloud.Nodes(i).sF.getValueDx([xTest(1);xTest(2)]);
nu1=nu1+temp(1);
nu2=nu2+temp(2);
end
nu1
nu2
%% Point on Shape Function Deriviative
shape=1;
T=Mesh.Elements(1).getIntCord(1);
x=[T(1);T(2)];
value=PointCloud.Nodes(shape).sF.getValue(x)
derivative=PointCloud.Nodes(shape).sF.getValueDx(x)
%% Plot Shape Function Derivative
figure(2)
Z1=zeros(size(X,1));
Z2=zeros(size(X,1));
for i=1:size(X,1) % Columns
for j=1:size(Y,2) % Rows
if 1
z=PointCloud.Nodes(shape).sF.getValueDx([X(i,j),Y(i,j)]);
Z1(i,j)=z(1); Z2(i,j)=z(2);
else
% Pass
end
end
end
% Plots!
subplot(1,2,1)
surf(X,Y,Z1,'facecolor','blue','EdgeColor','blue')
alpha(0.1)
hold on
for i=1:PointCloud.numberOfNodes
scatter(PointCloud.Nodes(i).cordinates(1),PointCloud.Nodes(i).cordinates(2),'ko','filled')
hold on
end
scatter(PointCloud.Nodes(shape).cordinates(1),PointCloud.Nodes(shape).cordinates(2),'r+')
subplot(1,2,2)
surf(X,Y,Z2,'facecolor','blue','EdgeColor','blue')
alpha(0.1)
hold on
for i=1:PointCloud.numberOfNodes
scatter(PointCloud.Nodes(i).cordinates(1),PointCloud.Nodes(i).cordinates(2),'ko','filled')
hold on
end
scatter(PointCloud.Nodes(shape).cordinates(1),PointCloud.Nodes(shape).cordinates(2),'r+')