Modify Example 3.2.1 so that instead of fixed numbers 10 and 10000, it takes user input for those numbers.
Answer.
m = input('How many numbers in a sum? ');
n = input('How many sums to compute? ');
A = rand(m, n);
S = sum(A, 1);
histogram(S, 30)
m = input('Number of rows: ');
n = input('Number of columns: ');
input command will be shown to the user as a prompt. When the user enters a number, that number gets assigned to the variable m. Same happens with n. After that the computation proceeds.m = input('How many numbers in a sum? ');
n = input('How many sums to compute? ');
A = rand(m, n);
S = sum(A, 1);
histogram(S, 30)