Integer division problem (gear ratio related)
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jimmy W
le 24 Oct 2016
Réponse apportée : KSSV
le 24 Oct 2016
Let's say A/B = 2.417. A and B both must be integers. I need to write a script to list some possible combos of A and B. Also 2.417 is a gear ratio rounded up to 4 significant figures, so it doesn't have to be exactly 2.417, but A and B must be something practical like 1-100. Any help would be greatly helpful!
0 commentaires
Réponse acceptée
Walter Roberson
le 24 Oct 2016
V = 1 : 100;
[A,B] = ndgrid(V);
R = A./B;
match = R > 2.416 & R < 2.418;
results = [A(match), B(match), R(match)]
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!