function [length] = spokecalc(T, hub_diam, rim_diam, flange_spacing, ... hole_diam) %% Function to calculate spoke lengths given spoke angle, and optionally %% other rim and hub dimensions. T may be a vector of spoke angles. %% Equations from The Bicycle Wheel (3rd Edition) by Jobst Brandt, p. 127 %% %% USAGE %% length = spokecalc(T, hub_diam, rim_diam, flange_spacing, hole_diam) %% %% INPUT %% T: (vector of) spoke angle in degrees %% hub_diam: diameter of hole circle in flange %% rim_diam: effective rim diameter %% flange_spacing: centre-to-centre flange spacing %% hole_diam: diameter of flange holes %% %% OUTPUT %% length: length of spoke required (round down!) th = T*2*pi/360; d = 62.5; % diameter of hole circle in flange D = 605; % effective rim diameter W = 69; % flange spacing (centre to centre) S = 2.5; % flange hole diameter if nargin > 1 d = hub_diam; end if nargin > 2 D = rim_diam; end if nargin > 3 W = flange_spacing; end if nargin > 4 S = hole_diam; end A = (d/2)*sin(th); B = D/2 - (d/2)*cos(th); C = W/2; length = sqrt(A.^2 + B.^2 + C.^2) - S/2;