function [Fx, Fy, Fz, Tx, Ty, Tz, Fxp, Fyp, Fzp, Txp, Typ, Tzp, Q] = SBT_helical_Lighthill_2(a_lambda, theta, nlength, res, omega, R, b, h) % Note that these output forces are normalized by 4 pi mu! function m = rotmatrix(angle) m=[cos(angle), -sin(angle), 0; sin(angle), cos(angle), 0; 0, 0, 1]; end phimin=0; phimax=nlength*(2*pi); xi=@(phi) sqrt(2 - 2*cos(phi(2)-phi(1))+(phi(2)-phi(1))^2/(tan(theta)^2)); fx12=@(phi) [cos(phi(1))-cos(phi(2)), sin(phi(1))-sin(phi(2)), (phi(1)-phi(2))/tan(theta)]; px12=@(phi) (rotmatrix(-phi(1))*(fx12(phi)'*fx12(phi))*rotmatrix(phi(2))/xi(phi)^3+rotmatrix(phi(2)-phi(1))/xi(phi)); Xnorm = @(phi) sqrt(R^2 + (R*phi/tan(theta)+b+h)^2); Xj = @(phi) [R*cos(phi); R*sin(phi); R*phi/tan(theta)+b+h]; nres=floor(nlength*res+.5); dphi=(phimax-phimin)/nres; vphi=phimin+.5*dphi:dphi:phimax-.5*dphi; mattr=zeros(3*nres, 3*nres); cutofflen=a_lambda*pi*exp(0.5)*cos(theta); cl=log(.5*dphi/cutofflen); % Approximation! for i=1:nres mattr(i,i)=1+cl; mattr([nres+i, 2*nres+i], [nres+i, 2*nres+i])=[cos(theta)^2+(1+sin(theta)^2)*cl, (cl-1)*sin(theta)*cos(theta); (cl-1)*cos(theta)*sin(theta), sin(theta)^2+(1+cos(theta)^2)*cl]; end for i=1:nres for j=1:nres if (abs(vphi(i)-vphi(j))