How to make two conditions for a while loop?
38 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Andy
le 13 Oct 2012
Réponse apportée : Sebastian Arteaga
le 9 Nov 2021
I'm making an application for L'hopitals rule so I need a while loop whenever the limit of f(x) and g(x) are both 0. How would I do that?
This is what I have
while(limit(a)=0 & limit(b)=0)
0 commentaires
Réponse acceptée
Wayne King
le 13 Oct 2012
Modifié(e) : Wayne King
le 13 Oct 2012
You need the == equals
while(x==0 & y==0)
For example:
syms x
y = x;
f = x^2;
if (limit(y,x,0)==0 & limit(f,x,0)==0)
disp('true');
else
disp('false');
end
0 commentaires
Plus de réponses (2)
trinuj Vongsomtakul
le 15 Fév 2015
Modifié(e) : Image Analyst
le 15 Fév 2015
How do I write
while (testPerformance > 9 & valperformance >9)
ii = ii+1;
in MATLAB? It is an error when i try to run it. I would like to stop the iteration when these 2 conditions are met.
3 commentaires
Anom Sulardi
le 17 Juin 2020
while (testPerformance > 9 && valperformance >9)
ii = ii+1;
if ii==ii(end)
end
% other code....
end
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements 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!