Finding Multiple Solutions to a Single Equation by Varying a Set of Variables
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marcus Solis
am 3 Jul. 2019
Kommentiert: Marcus Solis
am 4 Jul. 2019
Hi,
I am trying to find different gear tooth counts based on an equation for a gear ratio. I want the number of teeth for each gear to be from 20 to 60 teeth. The equation for the gear ratio is:
N = (G1 * G4) / ((G1-G3) * (G2-G1))
How would I go about getting a 4 column matrix with all the possible tooth count combinations?
Here is what I have so far:
N = 200; % Gear Ratio
G1 = 20:1:60; % Gear 1 tooth count
G2 = 20:1:60; % Gear 2 tooth count
G3 = 20:1:60; % Gear 3 tooth count
G4 = 20:1:60; % Gear 4 tooth count
N = (G1.*G4)./((G1-G3).*(G2-G1)); % Gear Ratio calculation
Also, is there a way to go about getting a range of the gear ratio as well? For example, if I wanted anything within +/- 5% of the desired ratio.
Thanks!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 3 Jul. 2019
N = 200; % Gear Ratio
G1 = 20:1:60; % Gear 1 tooth count
G2 = 20:1:60; % Gear 2 tooth count
G3 = 20:1:60; % Gear 3 tooth count
G4 = 20:1:60; % Gear 4 tooth count
[G1g, G2g, G3g, G4g] = ndgrid(G1, G2, G3, G4);
N = (G1g.*G4g)./((G1g-G3g).*(G2g-G1g)); % Gear Ratio calculation
Gear1 = G1g(:); Gear2 = G2g(:); Gear3 = G3g(:); Gear4 = G4g(:); Ratio = N(:);
result = table(Gear1, Gear2, Gear3, Gear4, Ratio);
This will be a table with nearly 3 million results ranging from -3600 to +3540 and over 135000 Inf results. There are 304995 unique results.
3 Kommentare
Walter Roberson
am 3 Jul. 2019
mask = result.Ratio < 100 | result.Ratio > 2000;
selected_result = result(mask,:);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Gears finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!