function F = Calc_Apical_Con_Force(V, nx, ny, S, M)

Vx = V(:, 1);
Vz = V(:, 3);

X = reshape(Vx, nx, ny, 2);
Z = reshape(Vz, nx, ny, 2);

X_left = X(2:(nx/2+1), 1, 1) - X(1:(nx/2), 1, 1);
Z_left = Z(2:(nx/2+1), 1, 1) - Z(1:(nx/2), 1, 1);

X_right = X((nx/2):(end-1), 1, 1) - X((nx/2+1):end, 1, 1);
Z_right = Z((nx/2):(end-1), 1, 1) - Z((nx/2+1):end, 1, 1);

X_linspace = linspace(-5, 5, nx)';

F_mag = M*abs(X_linspace.*exp(-(X_linspace/S).^2));

Fx = zeros(size(F_mag));
Fy = zeros(size(F_mag));
Fz = zeros(size(F_mag));

% For the left side
Fx(1:(nx/2)) = F_mag(1:(nx/2)).*X_left./sqrt(X_left.*X_left + Z_left.*Z_left);
Fz(1:(nx/2)) = F_mag(1:(nx/2)).*Z_left./sqrt(X_left.*X_left + Z_left.*Z_left);

% For the right side
Fx((nx/2+1):nx) = F_mag((nx/2+1):nx).*X_right./sqrt(X_right.*X_right + Z_right.*Z_right);
Fz((nx/2+1):nx) = F_mag((nx/2+1):nx).*Z_right./sqrt(X_right.*X_right + Z_right.*Z_right);


F = [[Fx, Fy, Fz];[Fx, Fy, Fz];zeros(2*nx, 3)];
end