ilaplace() function is giving wrong results

20 views (last 30 days)
David
David on 3 Sep 2020
Edited: David Goodmanson on 7 Sep 2020
HI,
I am using ilaplace() function to transform a function with this aspect
The temporal form of that function is a linear combination of a constant term and two exponentials.
I am particularly interested in noting that f(t) is a linear combination of a,b, and c. If I run this code
syms s t a b c d e f;
Fs = (a*s^2+b*s+c)/(s*(d*s^2+e*s+f));
ft = ilaplace(Fs)
The result is
Which IMHO is NOT a linear combination of a, b, and c. Why am I getting this? The result seems wrong to me.
Thanks in advanced.
EDIT:
Found the solution. Just use this function before applyting inverse Laplace tansform to F.
partfrac(F,'FactorMode','complex')
  1 Comment
Walter Roberson
Walter Roberson on 3 Sep 2020
Maple agrees with MATLAB as to what the inverse laplace transform is.

Sign in to comment.

Answers (1)

David Goodmanson
David Goodmanson on 3 Sep 2020
Edited: David Goodmanson on 7 Sep 2020
Hi David,
plugging in
cosh(z) = ((exp(z) + exp(-z))/2
sinh(z) = ((exp(z) - exp(-z))/2
results in a constant and two exponentials, as you said.
Note that in the expression for #1, the d in the denominator belongs in the argument for the square root. It does not belong under the entire expression. The fraction bar is too long, and it looks quite likely that the expression for ft has similar problems.
If you want to find the coefficients of the exponentials with a minimum of fuss, the following works.
<< the original question has been modified and includes the form shown here below >>
Find the roots of (d*s^2 + e*s + f), and reverse their signs to obtain r1,r2. Then
F(s) = (a*s^2+b*s+c) / (d*s*(s+r1)*(s+r2))
The solution has the form A0 + A1* exp(-r1*t) + A2*exp(-r2*t).
For A0, evaluate F(s) at s = 0, neglecting s in the denominator.
For A1, evaluate F(s) at s = -r1, neglecting (s+r1) in the denominator.
For A2, evaluate F(s) at s = -r2, neglecting (s+r2) in the denominator.
  8 Comments
David
David on 4 Sep 2020
Exponential terms are gone once the function is evaluated at a certain value of time. The only variables are inside coefficients a, b, and c, which are not inside any exponential.
David
David on 4 Sep 2020
Edited: David on 4 Sep 2020
I wrote a MWE of the whole problem. If I enter the laplace functions with the second order polynomial in the denominator, the non-linear problem arise.
syms s t a b c;
Fs1 = (100*a*s^2+98493*b)/(s*(784937*s^2+890384*s+8374));
Fs2 = (45450*a*s+983*c)/(s*(784337*s^2+8384*s-34));
Fs3 = (545*b*s+98563*c)/(s*(4337*s^2+834*s+345454));
ft1 = vpa(ilaplace(Fs1));
ft2 = vpa(ilaplace(Fs2));
ft3 = vpa(ilaplace(Fs3));
eqn1 = c == subs(ft1, 10);
eqn2 = b == subs(ft2, 10);
eqn3 = a == subs(ft3, 10);
[A, B] = equationsToMatrix([eqn1, eqn2, eqn3]);
However, if I replace the second order polynomial with its two roots, everything works fine.
syms s t a b c;
Fs1 = (100*a*s^2+98493*b)/(s*(s-1.1249)*(s-0.0095));
Fs2 = (45450*a*s+983*c)/(s*(s-0.0138)*(s+0.0031));
Fs3 = (545*b*s+98563*c)/(s*(s-9.0215)*(s+8.8282));
ft1 = vpa(ilaplace(Fs1));
ft2 = vpa(ilaplace(Fs2));
ft3 = vpa(ilaplace(Fs3));
eqn1 = c == subs(ft1, 10);
eqn2 = b == subs(ft2, 10);
eqn3 = a == subs(ft3, 10);
[A, B] = equationsToMatrix([eqn1, eqn2, eqn3]);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!