Matlab question Generate an array that is equal to the sum o
Matlab question
 Generate an array that is equal to the sum of the entries as you match up the array using: for, if commands
 Solution
g1=rand([20 1]); %Generates a random vector of 20
 g2=cumsum(g1); %Generates the cumulative sum ,ie g1(1), g1(1)+g1(2), etc.
 plot(g1)
 plot(g2)

