필터 지우기
필터 지우기

How can I use Kronecker delta for 3d matrix

조회 수: 9 (최근 30일)
MD MAHABUBUR ROHOMAN
MD MAHABUBUR ROHOMAN 2022년 10월 16일
답변: Vinayak Choyyan 2022년 10월 19일
I have a 10x10x10 = s(i,j,l) matrix. Lets say i,j,l rpresent the indices. How would I implement the Kronecker delta for the 3D case like the below 2D case? n=10
2D: delta(sij- s(pbc(i+1,n),j). The idea is if s_i = s_j then delta will give us 1 else 0.
How would I get like that in 3D?
  댓글 수: 1
Torsten
Torsten 2022년 10월 16일
delta(sij- s(pbc(i+1,n),j)
Not clear what this expression (with unbalanced parenthesis) wants to tell us.

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

답변 (1개)

Vinayak Choyyan
Vinayak Choyyan 2022년 10월 19일
Hi,
As per my understanding, you would like to create a 10x10x10 matrix with 0 in all locations except when indices i=j=k.
Please try the following code:
a=zeros(10,10,10);
for i = 1:10
a(i,i,i)=1;
end
To know more about zeros function check out this link
and to know more about for loop in MATLAB please check out this link

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by