chew socks
chew socks

Reputation: 1446

Matlab Symbolic Algebra not fully evaluated

In Matlab when I do

syms x d
laplace(heaviside(x)-heaviside(x-4))

I get

1/s - exp(-4*s)/s

But if I do

laplace(heaviside(x)-heaviside(x-d))

I get

1/s - laplace(heaviside(x - d), x, s)

Is there a way to force the last laplace to evaluate?

Upvotes: 4

Views: 149

Answers (1)

horchler
horchler

Reputation: 18484

Often if you want answers out of general symbolic expressions you need to apply assumptions. Using assume to specify that your parameter d is non-negative (a delayed step):

syms x d
assume(d>=0);
laplace(heaviside(x)-heaviside(x-d))

returns

ans =

1/s - exp(-d*s)/s

For arbitrary real values of d the result of your Laplace transform is a piecewise function (if you assume that d is negative then you'll obtain a different solution). It looks like the laplace function has not been designed to handle these cases via MuPAD's piecewise (except to return the original call). You might file a request for enhancement with The MathWorks to enquire about adding this functionality.

Upvotes: 1

Related Questions