-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStep6_plot_directional_porosity.m
106 lines (81 loc) · 2.1 KB
/
Step6_plot_directional_porosity.m
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MATLAB CODES ACCOMPANYING QUAN ET AL. (2021) PAPER
% CODES CALCULATE POROSITY ON PROCESSED X-RAY CT IMAGES
%
% STEP6: PLOT DIRECTIONAL POROSITY
% REFER TO README.MD FOR INSTRUCTION
%
% CITE AND CREDIT:
% SUN ET AL. (2021). POWDER TECHNOLOGY, 388:496-504.
% HTTPS://DOI.ORG/10.1016/J.POWTEC.2021.05.006
%
% TESTED ON MATLAB VERSION 2018(a) OR NEWER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc; clear; close all;
%% user input
% read and prepare the data
n = 5;% kernel size (L_e by voxel), must be identical with Step 3!!
% read the 3D binary matrix
% type = 'Loose'; for example 1
type = 'Steel'; % for example 2
%%
load([type '_' num2str(n) '_Dimensional_porosity.mat']);
%% Prepare variables
lenz = length(convex_por_z);
lenx = length(convex_por_x);
leny = length(convex_por_y);
z = [1:lenz];
x = [1:lenx];
y = [1:leny];
%% Plot directional porosity
% x-axis direction
h=figure
hold on
% scatter(x,porosity_x,12,'k','.')
plot(x,convex_por_x,'LineWidth' ,2)
set(gca, 'FontSize',16)
lgd=legend('X-direction');
lgd.FontSize=16;
lgd.Location='northeast'
box on
ax = gca;
ax.YLabel.String = 'Porosity';
ax.XLabel.String = 'Position (\it\mu\itm)';
ax.LineWidth=1
set(h,'Units','Inches');
xlim([0 lenx(end)])
ylim([0 1])
% y-axis direction
h=figure
hold on
% scatter(x,porosity_x,12,'k','.')
plot(y,convex_por_y,'LineWidth' ,2)
set(gca, 'FontSize',16)
lgd=legend('Y-direction');
lgd.FontSize=16;
lgd.Location='northeast'
box on
ax = gca;
ax.YLabel.String = 'Porosity';
ax.XLabel.String = 'Position (\it\mu\itm)';
ax.LineWidth=2
set(h,'Units','Inches');
xlim([0 leny(end)])
ylim([0 1])
% z-axis direction
h=figure
hold on
% scatter(x,porosity_x,12,'k','.')
plot(z,convex_por_z,'LineWidth' ,2)
set(gca, 'FontSize',16)
lgd=legend('Z-direction');
lgd.FontSize=16;
lgd.Location='northeast'
box on
ax = gca;
ax.YLabel.String = 'Porosity';
ax.XLabel.String = 'Position (\it\mu\itm)';
ax.LineWidth=2
set(h,'Units','Inches');
xlim([0 lenz(end)])
ylim([0 1])