Using while loop in normalized matrix

1 view (last 30 days)
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)

Accepted Answer

KSSV
KSSV on 22 Sep 2021
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 Comment
Kamil Dyga
Kamil Dyga on 22 Sep 2021
Thank you :)
Maybe you have some solution how can I search quicker needed value?

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!