![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/738374/image.png)
limiting range of solution of matrix
조회 수: 2 (최근 30일)
이전 댓글 표시
Essentially i only have A=9x1 and x=1:7. B is the resulting values of A*x and they are given as 9 different values which is what i need. Basically i need a loop to run through the caluclation of A*x=B until a single value of the 9 given by B is over 60. once any of said values hits 60 i need the loop to stop and display all 9 B values that are accepted and the x value that gives these B values that are less than the tolerance of 60. Ive attached a screenshot of what i have so far. However, it just runs through the loop without stopping when the B values i want to limit to are exceeded. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/737344/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/737344/image.png)
댓글 수: 1
Fabio Freschi
2021년 9월 14일
편집: Fabio Freschi
2021년 9월 14일
Do not share screenshot but use the CODE environment
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/738374/image.png)
If b is a vector, b > 0 is a vector of logical values. If you need to check if only one of the entry of b is larger than 0, use
if any(b>0)
Another thing is not proper in your code: the matrix A does not depend on m and it is constant through the iterations: you can move it outside the loop along with the statement w = 1;
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!