clear all
close all
addpath Resistance
nu = 1.18831e-6;
rho = 1025.9;
g = 9.806;
%======== The ship dimensions ====================================
L = 90;
Lw = 85.019;
B = 18.8;
T = 6.05;
Tf = T;
Ta = T;
Cb = 0.768;
Cwp = 0.917;
Cm = 0.929;
LCB = 44.341;
SW = 2209.729;
DisV = Cb*L*B*T;
Dis = rho*DisV;
Cp = Cb/Cm;
lcb = LCB/Lw*100;
Abt=5.04;
hb=4;
At=10.8;
Cstern=-15;
V1 = [0:0.5:40];
Rt=[0:0.1:1];
v = V1*0.5144;
[Rf, Rw, Rt, Cf, FormFactor,Fn] = Resistance(rho, nu,L, g, Lw, B,...
T, Tf, Ta, v, Cwp, Cm, DisV, Cb, Cp, lcb, SW,LCB,Abt,hb,At,Cstern);
PE=v.*Rt;
%============ Plot the resistance and effective power curves ============
figure(1)
subplot(3, 1, 1)
plot(V1, Rt,'g',V1, Rf, 'r',V1, Rw,'b')
ylabel('R_S(g) ,R_f(r) ,R_w(b) (kN)');
xlabel('V (knots)');
grid on
figure(1)
subplot(3, 1, 2)
plot(V1, PE,'r')
ylabel('P_E,} (kW)');
xlabel('V (knots)');
grid on
figure(1)
subplot(3, 1, 3)
plot(V1, Fn, 'k')
ylabel( 'froude.NO.L');
xlabel('V (knots)');
grid on