Documentation

# laplace

Laplace transform

## Syntax

``laplace(f)``
``laplace(f,transVar)``
``laplace(f,var,transVar)``

## Description

example

````laplace(f)` returns the Laplace Transform of `f`. By default, the independent variable is `t` and transformation variable is `s`.```

example

````laplace(f,transVar)` uses the transformation variable `transVar` instead of `s`.```

example

````laplace(f,var,transVar)` uses the independent variable `var` and the transformation variable `transVar` instead of `t` and `s`, respectively.```

## Examples

collapse all

Compute the Laplace transform of `1/sqrt(x)`. By default, the transform is in terms of `s`.

```syms x y f = 1/sqrt(x); laplace(f)```
```ans = pi^(1/2)/s^(1/2)```

Compute the Laplace transform of `exp(-a*t)`. By default, the independent variable is `t`, and the transformation variable is `s`.

```syms a t f = exp(-a*t); laplace(f)```
```ans = 1/(a + s)```

Specify the transformation variable as `y`. If you specify only one variable, that variable is the transformation variable. The independent variable is still `t`.

`laplace(f,y)`
```ans = 1/(a + y)```

Specify both the independent and transformation variables as `a` and `y` in the second and third arguments, respectively.

`laplace(f,a,y)`
```ans = 1/(t + y)```

Compute the Laplace transforms the Dirac and Heaviside functions.

```syms t s laplace(dirac(t-3),t,s)```
```ans = exp(-3*s)```
`laplace(heaviside(t-pi),t,s)`
```ans = exp(-pi*s)/s```

Show that the Laplace transform of the derivative of a function is expressed in terms of the Laplace transform of the function itself.

```syms f(t) s Df = diff(f(t),t); laplace(Df,t,s)```
```ans = s*laplace(f(t), t, s) - f(0)```

Find the Laplace transform of the matrix `M`. Specify the independent and transformation variables for each matrix entry by using matrices of the same size. When the arguments are nonscalars, `laplace` acts on them element-wise.

```syms a b c d w x y z M = [exp(x) 1; sin(y) i*z]; vars = [w x; y z]; transVars = [a b; c d]; laplace(M,vars,transVars)```
```ans = [ exp(x)/a, 1/b] [ 1/(c^2 + 1), 1i/d^2]```

If `laplace` is called with both scalar and nonscalar arguments, then it expands the scalars to match the nonscalars by using scalar expansion. Nonscalar arguments must be the same size.

`laplace(x,vars,transVars)`
```ans = [ x/a, 1/b^2] [ x/c, x/d]```

Compute the Laplace transform of symbolic functions. When the first argument contains symbolic functions, then the second argument must be a scalar.

```syms f1(x) f2(x) a b f1(x) = exp(x); f2(x) = x; laplace([f1 f2],x,[a b])```
```ans = [ 1/(a - 1), 1/b^2]```

If `laplace` cannot transform the input then it returns an unevaluated call.

```syms f(t) s f(t) = 1/t; F = laplace(f,t,s)```
```F = laplace(1/t, t, s)```

Return the original expression by using `ilaplace`.

`ilaplace(F,s,t)`
```ans = 1/t```

## Input Arguments

collapse all

Input, specified as a symbolic expression, function, vector, or matrix.

Independent variable, specified as a symbolic variable. This variable is often called the "time variable" or the "space variable." If you do not specify the variable then, by default, `laplace` uses `t`. If `f` does not contain `t`, then `laplace` uses the function `symvar` to determine the independent variable.

Transformation variable, specified as a symbolic variable, expression, vector, or matrix. This variable is often called the "complex frequency variable." If you do not specify the variable then, by default, `laplace` uses `s`. If `s` is the independent variable of `f`, then `laplace` uses `z`.

collapse all

### Laplace Transform

The Laplace transform F = F(s) of the expression f = f(t) with respect to the variable t at the point s is

`$F\left(s\right)=\underset{0}{\overset{\infty }{\int }}f\left(t\right)\text{\hspace{0.17em}}{e}^{-st}dt.$`

## Tips

• If any argument is an array, then `laplace` acts element-wise on all elements of the array.

• If the first argument contains a symbolic function, then the second argument must be a scalar.

• To compute the inverse Laplace transform, use `ilaplace`.