Laplace
1. Polynomials
In Matlab, a polynomial is represented by a vector. To create a polynomial in Matlab, simply enter each coefficient of the polynomial into the vector in descending order. For instance, let's say you have the following polynomial: To enter this into Matlab, just enter it as a vector in the following manner
x = [1 3 -15 -2 9]
x = 1 3 -15 -2 9
Matlab can interpret a vector of length (n+1) as an nth order polynomial. Thus, if your polynomial is missing any coefficients, you must enter zeros in the appropriate place in the vector. For example,
would be represented in Matlab as:
y = [1 0 0 0 1]
You can find the value of a polynomial using the polyval( ) function. For example, to find the value of the above polynomial at s=2,
z = polyval([1 0 0 0 1], 2)
z = 17
You can also extract the roots of a polynomial. This is useful when you have a high-order polynomial such as Finding the roots would be as easy as entering the following command;
roots([1 3 -15 -2 9]) ans = -5.5745 2.5836 -0.7951 0.7860
You can also construct a polynomial using poly( ) function.
r = [-1, -2]; p = poly(r); ans = 1 3 2
You can interpret that the resulting polynomial is given by
2. Partial fraction expansion to perform inverse transform
In Matlab, you can perform partial fraction expansion using residue( ) function. The following is how to use the residue( ) function:
Example 1
You would like to find the inverse Laplace Transform of F(s) given by For this you have to decompose F(s) into simple terms uing partial fraction expansion:
Matlab code num =[1 0 12]; % Generate numerator polynomial den = [1 5 6 0]; % Generate denominator polynomial
[r,p,k] = residue(num, den)
This gives