필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

For loop for the variable and plot

조회 수: 1 (최근 30일)
Auryn_
Auryn_ 2018년 1월 26일
편집: Jan 2018년 1월 27일
Hello,
I have a matrix of correlations between particles (50 particles). I want to compute the correlations between them, at a distance l. That is, I need to compute V_a,V_(a+l).
If my variable V(a,a,b) where
a=1:50
b=1:100
Now I would like to make a loop and plot the following:
sum_a(V(a,a+l,:))
May I ask you to help me with this loop and the plot?
I have tried with this:
M=50;
for a=1:M
for l=a:M
V(a,l,:)=sum(V(a,a+l,:));
end
end
Unfortunately it doesn't work.
Thanks in advance for your reply.
  댓글 수: 4
Auryn_
Auryn_ 2018년 1월 27일
Hi,
I want
M=\sum_{a}[V(a, a+k,:)]
That is, a sum only in one of the variables.
With k I want to say that I want the interaction V(1,1+k,:) for a=1, etc.
k will go from 0 to 50.
I do not know how to express a and k in the for loop to express the correlations in the whole matrix.
Jan
Jan 2018년 1월 27일
편집: Jan 2018년 1월 27일
@Auryn_: I could try to make a smart guess, what "M=\sum_{a}[V(a, a+k,:)]" might mean. But why do you use a magic notation instead of a syntax the readers can know already? I do not understand the description as text also: "a sum only in one of the variables".
I still do not understand, what you are asking for. "I want the interaction V(1,1+k,:) for a=1, etc." How could I know what "etc." means here? What should be continued how? a=2, or V(2, 1+k, :), or V(1, 2+k, :), or b=1? Please explain it again. Maybe the mathematical notation helps.
While this thread has been closed, explain it clearly in the other thread: https://www.mathworks.com/matlabcentral/answers/379186-loop-and-plot-in-2d.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by