Question
2x>1 then x=0
2x<=1 then x=1
3y>1 then y=0
3y<=1 then y=1
Then find sum x and sum y.
Solution Preview
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.
% Clearing the screen and workspaceclear all
clc;
% Generating random x and y using function rand which generates uniformly distributed pseudorandom numbers
n = 10000; % Number of instances
x=rand(1,n);
y=rand(1,n);
% Checking 2x>1->0, 2x<=1->1, 3y>1->0, 3y<=1->1
for i = 1:n
if 2*x(1,i)>1
x(1,i) = 0;
else...
By purchasing this solution you'll be able to access the following files:
Solution.m.