How to make two conditions for a while loop?
269 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Wayne King
2012-10-13
编辑:Wayne King
2012-10-13
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 个评论
更多回答(2 个)
trinuj Vongsomtakul
2015-2-15
编辑:Image Analyst
2015-2-15
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 个评论
Anom Sulardi
2020-6-17
while (testPerformance > 9 && valperformance >9)
ii = ii+1;
if ii==ii(end)
end
% other code....
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!