-
Notifications
You must be signed in to change notification settings - Fork 4
/
Comparison.m
61 lines (49 loc) · 1.01 KB
/
Comparison.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
clc
clear
close all
%% Data I/O %%
dir1 = 'DATA'
dir2 = 'RESULT'
fn1 = 'CHANNEL_0180_profile.plt'
fn2 = 'U.plt'
fn3 = 'k.plt'
fn4 = 'dissipation.plt'
strcat(dir1,'/',fn1)
data_p1 = fopen(strcat(dir1,'/',fn1));
data_p2 = fopen(strcat(dir2,'/',fn2));
data_p3 = fopen(strcat(dir2,'/',fn3));
data_p4 = fopen(strcat(dir2,'/',fn4));
A = fscanf(data_p1,'%f %f %f %f %f %f %f %f',[8 inf]);
B = fscanf(data_p2,'%f %f %f %f %f',[5 inf]);
C = fscanf(data_p3,'%f %f %f %f',[4 inf]);
D = fscanf(data_p4,'%f %f %f %f',[4 inf]);
fclose(data_p1)
fclose(data_p2)
fclose(data_p3)
fclose(data_p4)
%% Substitution %%
Y = B(1,:);
Yp = B(2,:);
U = B(4,:);
k = C(4,:);
dis = D(4,:);
Ny = size(B);
Ny = Ny(2)-1;
Y_exac = A(1,:);
Yp_exac = A(2,:);
U_exac = A(4,:);
k_exac = A(6,:);
dis_exac = A(8,:);
%% Plotting %%
figure
semilogx(Yp(1:Ny/2),U(1:Ny/2))
hold on
semilogx(Yp_exac,U_exac,'o')
figure
plot(Yp(1:Ny/2),k(1:Ny/2))
hold on
plot(Yp_exac,k_exac,'o')
figure
plot(Yp(1:Ny/2),dis(1:Ny/2))
hold on
plot(Yp_exac,dis_exac,'o')