-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintro.m
70 lines (54 loc) · 1.24 KB
/
intro.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
%% Introduction pictures
% copied from jfm_PaperPics in N:\RDS\WAMIT\array_study\jfm
% 0) set up stuff
folder = 'C:\Users\s1213969\Dropbox\matlab\thesis\';
fontsi = 10;
figwid = 7;
fighei = 5;
% sine wave
a = 1;
lam = 10;
k = 2*pi/lam;
h = 20;
T = IWaves.Lam2T(lam, h);
beta = 0;
rho = 1000;
x = linspace(0, 30, 301);
wav2d = a*cos(k*x);
figure;
set(gcf, 'PaperPosition', [0 0 figwid fighei]);
plot(x,wav2d,'Linewidth',2)
fet;
axis off
print('-dpng', '-r400', [folder 'pics\wav2d']);
% plane wave
y = linspace(-20, 20, 401);
[X, Y] = meshgrid(x, y);
wavp = PlaneWaves(a, T, beta, h);
pwf = PlaneWaveField(rho, wavp, true, X, Y);
eta = pwf.Elevation;
figure;
set(gcf, 'PaperPosition', [0 0 figwid fighei]);
surf(X,Y,real(eta{1}));
fet;
axis off
print('-dpng', '-r400', [folder 'pics\plane_wave']);
% cylindrical wave
M = 6;
s = 20;
k = 2*pi/lam;
am = cirWaveCoefsFromSpread(M, s, k);
am = 6*am;
wavc = CirWaves('In', [0 0], {am}, T, h);
x = linspace(0, 60, 301);
y = linspace(-50, 50, 501);
[X, Y] = meshgrid(x, y);
cwf = IncCirWaveField(rho, wavc, true, X, Y);
eta = cwf.Elevation;
figure;
set(gcf, 'PaperPosition', [0 0 figwid fighei]);
surf(X,Y,real(eta{1}));
fet;
set(gca, 'Color', 'none');
axis off
print('-dpng', '-r400', [folder 'pics\curve_wave']);