You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: loadcond.m
    path of file: ./repos/MSS/HYDRO
    
    the code of the file until where you have to start completion: function loadcond(vessel)
% loadcond plots T_roll and T_pitch as a function of GM_T and GM_L. 
% The heave period T_heave is plotted as a function of draft T.
%
%     loadcond(vessel)
%
%  Input:
%     vessel: MSS vessel structure
%
% Author:    Thor I. Fossen
% Date:      2005-09-26
%            2019-04-25 Extended to inlcude heave, roll and pitch 

% Vessel data
m   = vessel.main.m;
T = vessel.main.T;
R44 = vessel.main.k44;
R55 = vessel.main.k55;
g = 9.81;
Ix = vessel.MRB(4,4);
Iy = vessel.MRB(5,5);

% Vessel periods
per = DPperiods(vessel);
T3 = per(3);  T4 = per(4);  T5 = per(5);
w3 = 2*pi/T3; w4 = 2*pi/T4; w5 = 2*pi/T5;

A44 = interp1(vessel.freqs,reshape(vessel.A(4,4,:),1,length(vessel.freqs)),w4);
A55 = interp1(vessel.freqs,reshape(vessel.A(5,5,:),1,length(vessel.freqs)),w5);
M44 = Ix + A44;
M55 = Iy + A55;

kappa_roll  = A44/(m*R44^2);

    
function loadcond(vessel)
% loadcond plots T_roll and T_pitch as a function of GM_T and GM_L. 
% The heave period T_heave is plotted as a function of draft T.
%
%     loadcond(vessel)
%
%  Input:
%     vessel: MSS vessel structure
%
% Author:    Thor I. Fossen
% Date:      2005-09-26
%            2019-04-25 Extended to inlcude heave, roll and pitch 

% Vessel data
m   = vessel.main.m;
T = vessel.main.T;
R44 = vessel.main.k44;
R55 = vessel.main.k55;
g = 9.81;
Ix = vessel.MRB(4,4);
Iy = vessel.MRB(5,5);

% Vessel periods
per = DPperiods(vessel);
T3 = per(3);  T4 = per(4);  T5 = per(5);
w3 = 2*pi/T3; w4 = 2*pi/T4; w5 = 2*pi/T5;

A44 = interp1(vessel.freqs,reshape(vessel.A(4,4,:),1,length(vessel.freqs)),w4);
A55 = interp1(vessel.freqs,reshape(vessel.A(5,5,:),1,length(vessel.freqs)),w5);
M44 = Ix + A44;
M55 = Iy + A55;

kappa_roll  = A44/(m*R44^2);
kappa_pitch = A55/(m*R55^2);

T_draft = 0.01:0.1:1.5*T;
T_heave = 2*pi*sqrt(2*T_draft/g);
GMT = 1:0.1:1.2*vessel.main.GM_T;
T_roll  = 2*pi*sqrt(M44./(m*g*GMT));
GML = 10:1:1.2*vessel.main.GM_L;
T_pitch  = 2*pi*sqrt(M55./(m*g*GML));

% Plots
figure(100)
subplot(311)
plot(T_draft,T_heave,'-','linewidth',2)
hold on
plot(T,T3,'r*','MarkerSize',7,'linewidth',2)
plot([0 max(T_draft)],[T3 T3],'k-')
hold off
legend