Using while loop in normalized matrix

조회 수: 1 (최근 30일)
Kamil Dyga
Kamil Dyga 2021년 9월 22일
댓글: Kamil Dyga 2021년 9월 22일
Hello,
How I should use 'while' loop to solve this problem?
I would like stop the program, when it will be x=1 and y=1 at the same moment?
a = 0.2;
b = 0.3;
c = rand
d = rand
m = [a c; b d];
d=normc(m);
x = d(1,1)+d(2,1)
y = d(1,2)+d(2,2)

채택된 답변

KSSV
KSSV 2021년 9월 22일
x = 0 ; y = 0 ;
a = 0.2;
b = 0.3;
while ~(x == 1 && y == 1)
c = rand ;
d = rand ;
m = [a c; b d];
d=normc(m);
x = d(1,1)+d(2,1)
y = d(1,2)+d(2,2)
end
  댓글 수: 1
Kamil Dyga
Kamil Dyga 2021년 9월 22일
Thank you :)
Maybe you have some solution how can I search quicker needed value?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by