Clear Filters
Clear Filters

Problem with symbolic variables in dirac functions

5 views (last 30 days)
Hello,
Can anybody tell me whats wrong with this:
clear all;
syms x1 x2 x0 x 'positive';
syms L 'positive';
d1=dirac(x-x0)
d2=subs(d1,{x1,x2,x0},{0,L,L/2})
The answer to this should be: d1=dirac(x-x0) d2=dirac(x-L/2)
but the response I get from Matlab:
d1 =
dirac(x - x0)
d2 =
dirac(L/2 - x)
why are the arguments of the dirac function in d2 (L/2-x) instead of (x-x0)? In symbolic calculations is it possible to specify somewhere that x1<x<x2 ??
Abhishek

Answers (1)

Walter Roberson
Walter Roberson on 19 Nov 2011
Note: you should not be quoting anything in the syms command.
syms x1 x2 x0 x positive;
The Dirac delta function, dirac, has the value 0 for all x not equal to 0 and the value Inf for x = 0.
You can see from this description that the only important information is whether the value is 0 or not. Therefore the sign of the expression is irrelevant. dirac(x) is the same as dirac(-x)

Community Treasure Hunt

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

Start Hunting!