k = menu('please choose a number', '1', '4');
switch k
case 1
a = -10; b = 10;
result = a + (b-a) * rand(1);
case 4
a = 0; b = 1;
result = a + sqrt(b) * randn(1);
end
disp(result);
k = menu('please choose a number', '1', '4');
switch k
case 1
a = -10; b = 10;
result = a + (b-a) * rand(1);
case 4
a = 0; b = 1;
result = a + sqrt(b) * randn(1);
end
disp(result);
举报