A problem with an iteration procedure
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Hi everyone. I'm writing an iteration procedure that should calculate some values until the difference
X(i,j)-Y(i,j)<0.0001
where X and Y are 17by11 matrices. I have to compare each X(i,j) value with Y(i,j). I tried with a while loop with condition
max(max(err))>=0.0001
(err=X-Y) but there are some elements that don't match to the condition.
Thanks for helping and sorry for my bad english.
댓글 수: 1
Azzi Abdelmalek
2013년 2월 12일
Post your code.
답변 (2개)
Azzi Abdelmalek
2013년 2월 12일
er=X-Y
idx=find(er<0.0001,1)
Then write your iteration:
for k=1:idx
%your code
end
댓글 수: 1
Azzi Abdelmalek
2013년 2월 12일
%or maybe you want to compare
er=X-Y
if sum(abs(er))<0.0001
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!