how can i get the cumsum of a 3D matrix.

3 visualizaciones (últimos 30 días)
Folakemi Omotoye
Folakemi Omotoye el 18 de Jul. de 2018
Comentada: Folakemi Omotoye el 19 de Jul. de 2018
i have a 3-D matrix.I want to use the cumsum algorithm to plot all the matrix as a signal. i have the following code
m=zeros(10,10,30); %define 3-D 10 by 10 by 30 matrix
n=30; %number of matrix
for k=1:n
t=linspace(0,1.0,n); %specify the value an element will take in each iteration
m(3,3,k) = t(k); %the 3rd row and 3rd column in each matrix will have the value of t
disp(m(:,:,k))
end
for k=1:n
a=cusum(m(:,:,k))
plot (a)
hold on
end
  10 comentarios
Rik
Rik el 19 de Jul. de 2018
Could you describe your intended resulting plot by describing how the the x and y values of each point in the plot should result from your matrix?
Folakemi Omotoye
Folakemi Omotoye el 19 de Jul. de 2018
The aim is to achieve a signal in this form (attached picture)

Iniciar sesión para comentar.

Respuestas (1)

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro el 19 de Jul. de 2018
To be able to properly help you, the problem needs to be well defined. As context, what you obtain with cumsum is an accummulation of values along one dimension of the data. So you can find this accummulation along any dimension you want. Think of it with a 1D matrix, many values and they accummulate within the dimension. If you have a probability distribution, the last value of the cumsum should always be 1.
If what you want is to find a projection, or in proper statistical terms, a marginal distribution, then you need to use sum( , dim) along the dimension of interest.
  1 comentario
Folakemi Omotoye
Folakemi Omotoye el 19 de Jul. de 2018
I tried the cumsum and i specified the dimension but there was error saying dimensions must be the same. the aim is to achieve a signal in this form(see pic attached) of the changing pixels

Iniciar sesión para comentar.

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by