I have been asked to create a matrix of uniform data of size nxn using the rand function. Then I am to average across the 2nd dimension using the mean function and then plot the results.
Here is what I have so far:
%Number of datapoints
samples = 100;%Create a Matrix of samples (nxn)
dataUniform = rand(samples);
I am then trying to get the mean of the second dimension doing the following:
meanData = mean(dataUniform,2);
No matter what way I try the mean function I get the following error on the line with the mean function:
Subscript indices must either be real positive integers or logicals.
Can anyone let me know where I am going wrong? I assume it is because the matrix produced is from the values of 0 to 1 all of which being decimals.
Any help would be appreciated.
Best Answer