How to use kroneckerdelta in programming

조회 수: 27 (최근 30일)
YOGESHWARI PATEL
YOGESHWARI PATEL 2016년 12월 16일
편집: KSSV 2016년 12월 17일
I want to use the Kroneckerdelta function in my programming.I also check the syntax for it. It is given as kroneckerDelta(m,n).But when i used this syntax in my programming it is showing error Undefined function 'DiracDelta' for input arguments of type 'double'.What does it mean?
  댓글 수: 2
KSSV
KSSV 2016년 12월 16일
What version of MATLAB you are using? Does help Kroneckerdelta gives details about the function?
John D'Errico
John D'Errico 2016년 12월 16일
See my answer...

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

답변 (2개)

John D'Errico
John D'Errico 2016년 12월 16일
You are doing this:
kroneckerDelta(2,3)
Undefined function 'kroneckerDelta' for input arguments of type 'double'.
As you see, MATLAB fails to work, even though I have the symbolic TB, in the current release. Why does it fail? Because I called it with double precision arguments. That function is part of the symbolic TB. In order for it to work, the arguments (at least one of them) must be symbolic.
kroneckerDelta(sym(2),3)
ans =
0

KSSV
KSSV 2016년 12월 16일
편집: KSSV 2016년 12월 17일
You can also write your own function, without syms...
function d = kronDel(j,k)
if j == k
d = 1;
else
d = 0;
end
  댓글 수: 1
YOGESHWARI PATEL
YOGESHWARI PATEL 2016년 12월 16일
sir you ask me calculate the value of Kroneckerdelta function separately.But my Kroneckerdelta is in for loop.So whether this will give me the correct value after each loop calculation.

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

카테고리

Help CenterFile Exchange에서 Mathematical Functions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by