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: kro.m
    path of file: ./repos/FVTool/FieldGeology
    
    the code of the file until where you have to start completion: % relperm and capillary pressure curves
% to be used with FVTool package
% Written by Ali A. Eftekhari
% This is what this function does:
% res=zeros(size(sw));
% for i=1:numel(sw)  
%   if swc(i)<=sw(i) && sw(i)<=1-sor(i)
%     res(i)=kro0(i)
    
function does:
% res=zeros(size(sw));
% for i=1:numel(sw)  
%   if swc(i)<=sw(i) && sw(i)<=1-sor(i)
%     res(i)=kro0(i)*((1-sw(i)-sor(i))/(1-sor(i)-swc(i)))^no(i);
%   elseif 0.0<sw(i) && sw(i)<swc(i)
%     res(i)=1+(kro0(i)-1)/swc(i)*sw(i);
%   elseif sw(i)>1-sor(i)
%     res(i)=0.0;
%   elseif sw(i)<=0.0
%     res(i)=1.0;
%   end