Calculating gear ratios for an orrery An orrery is a mechanical model of the sol
ID: 3877225 • Letter: C
Question
Calculating gear ratios for an orrery An orrery is a mechanical model of the solar system. Gear ratios approximate the ratio of orbital periods for various planets and accurate ratios are necessary to build an accurate orrery. The numerator and denominator of the rational approximation corresponds to the number of teeth in the two gears that model the corresponding orbits Calculate the ratio approximation of planet1Period and planet2Period within ratio Tolerance. Assign the numerator to approxNum and denominator to approxDen. Ex: If planet1Period is 1 (orbital period of Earth in years) and planet2Period is 1.881 (orbital period of Mars in years), then approxNum is 8 and approxDen is 15 Your Function Save Reset MATLAB Documentation 1 function approxNun, approxDen] = GearRatio( planet!Period, planet2Period, ratioTolerance ) 2 % GearRat 10: Return numerator and denominator of gear ratio that 3% approximates the ratio of the inputs period!/period2 within the 4% input tolerance. 5% Inputs : planet!Period, planet2Period - input periods ratioTolerance - required accuracy of approximation 71 % 8% Outputs: approxNun, approxDen - numerator and denominator of gear ratio 9 10 11 % Calculate the ratio approximation of planet!Period / planet 2Period within ratioTolerance 12 13 14 15 16 end 17 % Assign the numerator to approxNum and denominator to approxDenExplanation / Answer
% Create a method named "GearRatio" to find the approximate numerator and approximate denominator.
function [approxNum, approxDen] = GearRatio(planet1Period,planet2Period,ratioTolerance)
% Calculate gear ratio
[num, den] = rat(planet1Period/planet2Period, ratioTolerance);
% Assign numerator to approxNum
approxNum = num;
% Assign denominator to approxDen
approxDen = den;
end
% Call [approxNum, approxDen] = GearRatio(1.0,1.881,0.01)
=====================================================
OUTPUT:
[approxNum, approxDen] = GearRatio(1.0,1.881,0.01)
approxNum =
8
approxDen =
15
>> [approxNum, approxDen] = GearRatio(1.0,1.881,0.001)
approxNum =
17
approxDen =
32
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.