I have 234 rows and 10,000 columns. I want to find out the value of the integral as mentioned in the screenshot. For this, I am using the Riemann integral. The procedure I am following is -
One column operation only
- Find the standard deviation of 1 element only - I have initialised as 0.
- Find the standard deviation of 1st and 2nd element only - Input in the matrix
- Find the standard deviation of 1st, 2nd and 3rd element only - Input in the matrix
- This is done in a loop for 234 times only.
- Finally the sum of the entire column is taken to find the value of the intergral (using the Riemann intergral)
The same step needs to be done for 10,000 times and thus, the output will be a matrix of 1*10,000.
My code (only for 1 column) is as follows which does not work-
X1= X(:,1); %Gives the first column of the entire matrix of 10,000
n=length(X1) %Finds the length of the column to repeat the number of iterations
for i=1:n %For loop to run the same process from row 1 to row 234 in column 1 only
i %Gives the process number where it is running
sumpara(1) = X1(1); Initialised the first value of the sum
sumpara(i+1)= sumpara(i)+X1(i+1); %Gives the formula for the summing up the row elements in the same column
if(i>=n) %Was given an error- "Index exceeds the number of array elements (234)." So i put this code, but it keeps running the program and gives me "Continue entering statement" in the status bar.
sumparat=sumpara' %Wanted the output as a column, so taken the trasnspose
I have mentioned the comments for every line in the code. Can anyone help me in finding the error and correcting the code?
Thanks in advance.