-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFor_A2dA1Wave_A_pack_figure10.m
executable file
·171 lines (154 loc) · 4.83 KB
/
For_A2dA1Wave_A_pack_figure10.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
clc
clear all
close all
cd G:\orange_backup % any dir
list0=dir('g3.0a*');
n0=length(list0);
s=0;
sp=0;%counting number of lines
for j=1:n0
cd (list0(j).name)
list=dir('0*');
n=length(list);
cd ('../')
str=list0(j).name;
str(str=='r')=[];
str(str=='u')=[];
str(str=='n')=[];
str(str=='_')=[];
str(str=='z')=[];
str(str=='l')=[' '];
str1=str;
str(str=='g')=' ';
str(str=='a')=' ';
str(str=='m')=' ';
gam=str2num(str);
gamall(:,j)=gam;
A1=gam(2);
%CM = lines(10);
%{
for i=1:1
dirnamef=[list0(j).name,'/',list(i).name,'/'];
%v01=load([dirname,'VIV01.DAT']);
v01=load([dirnamef,'VIV01.DAT']);
disp(dirnamef);
%tn=length(v01)/5;%Number of lines plotted
s=s+1;
figure(s)
%plot(v01(1:tn,1),v01(1:tn,4),'color','b') % y displacement of cylinder 1 (forced)
%hold on;
plot(v01(:,1),v01(:,4),'color','b') % y displacement of cylinder 2 (free)
title([list0(j).name,' f1/fn2=',list(i).name,' VIV01'])
xlabel('t*fn2');
ylabel('X/D');
tiname=[list0(j).name,'_',list(i).name,'_VIV01'];
cd ('plotting')
print('-dpng','-r600',['Plotting_',tiname,'.png']);
cd ('../')
end
%}
for i=1:n
dirnamef=[list0(j).name,'/',list(i).name,'/'];
disp(dirnamef);
period=1/str2double(list(i).name); %
v02=load([dirnamef,'VIV02.DAT']);
t=v02(:,1);
y=v02(:,4);
period1n=0;
while true %count point number in one period
period1n=period1n+1;
if t(period1n)>=period
break
end
end
period1n=period1n*1;% number of periods for A=(max-min)/2
tn=length(t);
nperiod=floor(tn/(period1n));
for i1=1:nperiod %
tstartn=(i1-1)*period1n+1;
tendn=i1*period1n;
ymax(i1)=max(y(tstartn:tendn));
ymin(i1)=min(y(tstartn:tendn));
yamp(i1)=(ymax(i1)-ymin(i1))/2;
end
yampds=sort(yamp,'descend');
yampn=floor(1/3*(length(yampds)));% N of 1/3 values
%average of 1/3 value in the middle of yampds
%s=s+1;
%figure(s)
%plot(yampds(yampn:2*yampn))
%plot(yamp);
A2(i)=mean(yampds(yampn:2*yampn));
A2dA1(i)=A2(i)/A1;
f(i)=str2double(list(i).name);
clear ymax ymin yamp yampds t v02 y;
%
%{
title([list0(j).name,' f1/fn2=',list(i).name,' VIV02'])
xlabel('t*fn2');
ylabel('X/D');
tiname=[list0(j).name,'_',list(i).name,'_VIV02'];
cd ('plotting')
print('-dpng','-r600',['Plotting_',tiname,'.png']);
cd ('../')
%}
%{
dirnamef=[list0(j).name,'/',list(i).name,'/'];
%v02=load([dirnamef,'VIV02.DAT']);
disp(dirnamef);
% %tn=length(v02)/5;%Number of lines plotted
%s=s+1;
%figure(s)
%plot(v01(1:tn,1),v01(1:tn,4),'color','b') % y displacement of cylinder 1 (forced)
%hold on;
%plot(v02(:,1),v02(:,4),'color','r') % y displacement of cylinder 2 (free)
%
title([list0(j).name,' f1/fn2=',list(i).name,' Amplitude with time'])
xlabel('N');
ylabel('Amp');
tiname=[list0(j).name,'_',list(i).name,'_Amplitude with time'];
mkdir(['plotting/',list0(j).name])
cd (['plotting/',list0(j).name])
print('-dpng','-r600',['yampds_1_3_','1_periods',tiname,'.png']);
cd ('../')
cd ('../')
%}
end
%v02=load([dirnamef,'VIV02.DAT']);
% %tn=length(v02)/5;%Number of lines plotted
%s=s+1;
%figure(s)
%plot(v01(1:tn,1),v01(1:tn,4),'color','b') % y displacement of cylinder 1 (forced)
%hold on;
%plot(v02(:,1),v02(:,4),'color','r') % y displacement of cylinder 2 (free)
sp=sp+1;
if gam(1)==1
h(sp)=plot(f,A2dA1,'-');
end
if gam(1)==1.25
h(sp)=plot(f,A2dA1,'--');
end
hold on
legendInfo{j} = ['G=',num2str(gamall(1,j),4),' A_1=',num2str(gamall(2,j),4)];
end
%legend(['G=',num2str(gamall(1,1)),' A_1=',num2str(gamall(2,1))],'G=3.0 A_1=1.0','G=3.0 A_1=1.5','G=3.0 A_1=2.0','Location','northeast')
%title(['G=',num2str(gam(1)),' A1=',num2str(gam(2)),' m*=',num2str(gam(3))])
legend(legendInfo)
xlabel('f_1');
ylabel('A_2/A_1');
tiname=['G=',num2str(gam(1))];
set(gca,'XTick',0:0.2:2.5);
grid on
mkdir(['plotting/Amplitude_Frequency/'])
cd ('plotting/Amplitude_Frequency/')
print('-dpng','-r600',[tiname,'_A2dA1','.png']);
stop
%cd ('../')
%cd ('../')
[hleg1, hobj1] = legend;
set(hleg1,'position',[0.25 0.35 0.2 0.5])
set(hleg1,'FontSize',13)
%
set(hleg1,'FontSize',11)
set(hleg1,'position',[0.15 0.5 0.2 0.33])
print('-dpng','-r600',[tiname,'_A2dA1_details','.png']);