필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
Folakemi Omotoye
Folakemi Omotoye 2018년 7월 18일
댓글: Folakemi Omotoye 2018년 7월 19일
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
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?
Folakemi Omotoye
Folakemi Omotoye 2018년 7월 19일
The aim is to achieve a signal in this form (attached picture)

댓글을 달려면 로그인하십시오.

답변 (1개)

Constantino Carlos Reyes-Aldasoro
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
Folakemi Omotoye
Folakemi Omotoye 2018년 7월 19일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by