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

-1o.lu) 10:10 gen the oin vn e Sum ! 93) -t

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)

Matlab question Generate an array that is equal to the sum of the entries as you match up the array using: for, if commands -1o.lu) 10:10 gen the oin vn e Sum !

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site