-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaveHeights_vs_maxAccelerations.m
61 lines (61 loc) · 2.07 KB
/
WaveHeights_vs_maxAccelerations.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
%==========================================================================
% Wave heights vs. maximum accelerations
% Plot the distribution of accelerations for different wave heights
%==========================================================================
%%
clear; close all; clc
format long
letsz = 24; %Font Size
lw = 1.5;%Line width
sz = 150;
%--------------------------------------------------------------------------
%Data
H = [0.1,0.2,0.3,0.4];
maxSingleAcc = [0.0939,0.226762,0.536108,0.919977];
coeff = polyfit(H',maxSingleAcc',1);
%Data log
Hlog = log10(H);
maxSingleAcclog = log10(maxSingleAcc);
coeffx = polyfit(Hlog,maxSingleAcclog,1);
%--------------------------------------------------------------------------
% Plots
fig1 = figure;
scatter(H,maxSingleAcc,sz,'filled','MarkerFaceColor','m','MarkerEdgeColor','k','Marker','d')
xlim([0 0.45])
ylim([0 1])
xlabel('H/h')
ylabel('max.$\rm \big(\frac{Dw/Dt}{g}\big)$')
axis square
ax1 = gca;
ax1.LineWidth = 1.5;
set(gca,'TickDir','out')
set(gca,'XMinorTick','on','YMinorTick','on','ZMinorTick','on')
set(gca, 'FontSize', letsz)
set(gcf,'color','w');
box on
%--------------------------------------------------------------------------
%Inset figure
axes('Position',[0.360416666666667,0.561151079136691,0.178645833333333,0.352517985611511])
box on
% linear plot
scatter(H,maxSingleAcc,sz,'filled','MarkerFaceColor','m','MarkerEdgeColor','k','Marker','d');
xlim([0 0.45]);
ylim([0 1]);
% power law fit
Hlog = log10(H);
maxSingleAcclog = log10(maxSingleAcc);
coeffs = polyfit(Hlog,maxSingleAcclog,1);
% log plot
loglog(H,maxSingleAcc,'LineStyle','none','LineWidth',0.5,'Marker','d','MarkerFaceColor','m','MarkerEdgeColor','k','MarkerSize',12)
hold on;
loglog([0.1:0.1:0.45],(10^coeffs(2))*(0.1:0.1:0.45).^coeffs(1),'--','Color',[0.6 0.6 0.6])
xlabel('H/h')
ylabel('max.$\rm \big(\frac{Dw/Dt}{g}\big)$')
axis square
ax1 = gca;
ax1.LineWidth = 1.5;
set(gca,'TickDir','out')
set(gca,'XMinorTick','on','YMinorTick','on','ZMinorTick','on')
set(gca, 'FontSize', letsz)
set(gcf,'color','w');
box on