Delta Function
Delta Function
How To Buy
Log In
Products
Solutions
Academia
Support
Community
Events
Company
Search MATLAB Documentation
Documentation
Documentation
Toggle navigation
Trial Software
Product Updates
All Products
kroneckerDelta
Kronecker delta function
collapse all in page
Syntax
kroneckerDelta(m)
example
kroneckerDelta(m,n)
example
Description
example
example
Examples
Compare Two Symbolic Variables
Set symbolic variable m equal to symbolic variable n and test their equality
using kroneckerDelta.
syms m n
m = n;
kroneckerDelta(m, n)
ans =
1
ans =
kroneckerDelta(p - q, 0)
kroneckerDelta cannot decide if p == q and returns the function call with the undecidable
input. Note that kroneckerDelta(p, q) is equal to kroneckerDelta(p - q, 0).
To force a logical result for undecidable inputs, use isAlways. The isAlways function issues
a warning and returns logical 0 (false) for undecidable inputs. Set the Unknown option
to false to suppress the warning.
isAlways(kroneckerDelta(p, q), 'Unknown', 'false')
ans =
0
ans =
1
V =
1 2 3 4
m =
3
sol =
[ 0, 0, 1, 0]
kroneckerDelta acts on V element-wise to return a vector, sol, which is the same size as V.
The third element of sol is 1 indicating that the third element of V equals m.
Compare Two Matrices
Compare matrices A and B.
A =
[ m, m + 1, m + 2]
[ m - 2, m - 1, m]
B =
[ m, m + 3, m + 2]
[ m - 1, m - 1, m + 1]
sol =
[ 1, 0, 1]
[ 0, 1, 0]
kroneckerDelta acts on A and B element-wise to return the matrix sol which is the same size
as A and B. The elements of sol that are 1 indicate that the corresponding elements
of A and B are equal. The elements of sol that are 0 indicate that the corresponding
elements of A and B are not equal.
Use kroneckerDelta in Inputs to Other Functions
kroneckerDelta appears in the output of iztrans.
syms z n
sol = iztrans(1/(z-1), z, n)
sol =
1 - kroneckerDelta(n, 0)
Use this output as input to ztrans to return the initial input expression.
ztrans(sol, n, z)
ans =
z/(z - 1) - 1
collapse all
m Inputnumber | vector | matrix | multidimensional array | symbolic number | symbolic vector | symbolic matrix |
symbolic function | symbolic multidimensional array
Input, specified as a number, vector, matrix, multidimensional array, or a symbolic number,
vector, matrix, function, or multidimensional array. At least one of the inputs, m or n, must be
symbolic.
n Inputnumber | vector | matrix | multidimensional array | symbolic number | symbolic vector | symbolic matrix |
symbolic function | symbolic multidimensional array
Input, specified as a number, vector, matrix, multidimensional array, or a symbolic number,
vector, matrix, function, or multidimensional array. At least one of the inputs, m or n, must be
symbolic.
More About
expand all
Kronecker Delta Function
The Kronecker delta function is defined as
{
( )
m,n = 01if mif mn=n
Tips
When m or n is NaN, the kroneckerDelta function
returns NaN.
See Also
iztrans | ztrans
Introduced in R2014b
Getting Started
Examples
Release Notes
PDF Documentation
Other Documentation
MATLAB
Optimization Toolbox
All Products
Support
MATLAB Answers
Installation Help
Bug Reports
Product Requirements
Software Downloads