Using while loop in normalized matrix

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

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

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 Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 22 Sep 2021

Commented:

on 22 Sep 2021

Community Treasure Hunt

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

Start Hunting!