for j = 1:4
    n = (co(e(j,2),:) - co(e(j,1),:));
    n = n./norm(n);
    F = e(j,5).*e(j,4)./e(j,3).*-(dot(u,n)).*n
    theta = acosd(dot(F,n)/(norm(F)*norm(n)))
    if theta == 180
        F2 = [F2; -sqrt(F(1)^2 + F(2)^2 + F(3)^2)]
    else if theta == 0
            F2 = [F2; sqrt(F(1)^2 + F(2)^2 + F(3)^2)]
        end
    end
end
Essentially, what the issue is that the first value of F (for j = 1) in the if statement is being ignored, even though the value of theta is 180. To check, I've done 'whos theta' and even wrote theta == 180 into the code for which it returned 0. For j = 2:4 though, the code works absolutely fine despite j = 2 yielding a theta value of 180 as well. It's almost as if it's skipping the if statement entirely for j = 1. I believe this is linked to the fact that F is the only matrix vector with three non-zero components, but still don't know how to go about solving this.
 
     
    