ilaplace() function is giving wrong results
이전 댓글 표시
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
Walter Roberson
2020년 9월 3일
Maple agrees with MATLAB as to what the inverse laplace transform is.
답변 (1개)
David Goodmanson
2020년 9월 3일
편집: David Goodmanson
2020년 9월 7일
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
Walter Roberson
2020년 9월 4일
You might be able to get somewhere with rewrite()
However, it might require the more obscure and tricky mapSymType()
David
2020년 9월 4일
Walter Roberson
2020년 9월 4일
Sometimes you have to go through a mess of rewrite() and simplify() to push it into the form you want. But if a direct rewrite() does not work, then typically the chain to force in into a good form is fragile and could stop working at the next release.
So sometimes you are forced to use mapSymType(), which is more powerful but is also not quite designed properly, and so can get frustrating to use. Frustrating enough that anyone who knows the Symbolic Toolbox well enough to use mapSymType effectively is more likely to just drop into some evalin(symengine) or feval(symengine) to push the symbolic engine in productive ways.
In your case you might want to use mapSymType to implement the rule that David suggested,
cosh(z) = ((exp(z) + exp(-z))/2
It isn't pretty, but:
cosh2exp = @(z) (exp(z) + exp(-z))/2;
mapSymType(ft,'cosh',@(f) cosh2exp(children(f)))
and likewise for sinh
Walter Roberson
2020년 9월 4일
Did you already separate out the exponential term? The presenses of the exponential term would be enough for it to complain about it not being linear.
David
2020년 9월 4일
카테고리
도움말 센터 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
