how can i get the cumsum of a 3D matrix.
조회 수: 3 (최근 30일)
이전 댓글 표시
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
Rik
2018년 7월 19일
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?
답변 (1개)
Constantino Carlos Reyes-Aldasoro
2018년 7월 19일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!