Find all possible ordered pairs that satisfy a linear equation
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to find all possible combinations of X and Y that satisfy the following linear equation:
f = ((X*25)+(Y*(24))) == 100
The variables should only be evaluated in the following range:
1 ≤ X ≥ 7 and 0.1 ≤ Y ≥ 3 or put another way X = 1:0.01:7 and Y = 0.1:0.01:3
I assume there are multiple simple ways to solve this using either for loops or syms approaches.
0 commentaires
Réponses (1)
Star Strider
le 16 Mai 2021
The ‘all possible’ criterion would produce infinite solutions. I suspect you would spend the rest of your life calculationg it!
Here is a slightly more limited calculation —
B = 1;
k = 1;
while (B>=0.1) & (B<=7)
X(k,:) = k/10;
B = (100 - X(k,:)*25)/24;
Y(k,:) = B;
k = k+1;
end
Result = table(X,Y)
.
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!