A system for tracking a femoral frame of reference in computer-assisted surgery, comprising: a sensor unit adapted to be secured to the femur, the sensor unit comprising an accelerometer sensor and a gyroscope sensor both producing orientation data; a processing unit adapted to receive gyroscope data and accelerometer data and comprising: a gyroscope-data calculator for providing calculated acceleration data from at least the gyroscope data resulting from movements of the femur; an accelerometer-data calculator for calculating measured acceleration data from the accelerometer data resulting from movements of the femur; and an acceleration comparator for relating an orientation of the sensor unit to the femur to define a femoral frame of reference, the acceleration comparator performing a numerical optimization to determine the orientation of the sensor unit, the numerical optimization using at least a plurality of estimated radius values representative of a length of the femur with the calculated acceleration data and the measured acceleration data to determine a radius value corresponding to the acceleration data and the measured acceleration data at a knee end of the femur; a sensor orientation interface for providing orientation data for the femur from a tracking of the femoral frame of reference. a sensor unit adapted to be secured to the femur, the sensor unit comprising an accelerometer sensor and a gyroscope sensor both producing orientation data; a processing unit adapted to receive gyroscope data and accelerometer data and comprising: a gyroscope-data calculator for providing calculated acceleration data from at least the gyroscope data resulting from movements of the femur; an accelerometer-data calculator for calculating measured acceleration data from the accelerometer data resulting from movements of the femur; and an acceleration comparator for relating an orientation of the sensor unit to the femur to define a femoral frame of reference, the acceleration comparator performing a numerical optimization to determine the orientation of the sensor unit, the numerical optimization using at least a plurality of estimated radius values representative of a length of the femur with the calculated acceleration data and the measured acceleration data to determine a radius value corresponding to the acceleration data and the measured acceleration data at a knee end of the femur; a gyroscope-data calculator for providing calculated acceleration data from at least the gyroscope data resulting from movements of the femur; an accelerometer-data calculator for calculating measured acceleration data from the accelerometer data resulting from movements of the femur; and an acceleration comparator for relating an orientation of the sensor unit to the femur to define a femoral frame of reference, the acceleration comparator performing a numerical optimization to determine the orientation of the sensor unit, the numerical optimization using at least a plurality of estimated radius values representative of a length of the femur with the calculated acceleration data and the measured acceleration data to determine a radius value corresponding to the acceleration data and the measured acceleration data at a knee end of the femur; a sensor orientation interface for providing orientation data for the femur from a tracking of the femoral frame of reference.