Inverse Laplace transform - there has to be a better way?
조회 수: 95 (최근 30일)
이전 댓글 표시
I have a transfer function and I am applying a step input . My ultimate goal is to find the time response .
Solving by hand, I know that output .
Then by partial fraction expansion I know that .
From the above I can easily take the inverse Laplace transform and see that .
My goal is to obtain with as few keystrokes as possible.
The fastest way I have found is to perform the partial fraction expansion using residue():
num = 9;
denom = [1 9 9 0];
[r,p,k] = residue(num,denom);
which gives the result:
r =
0.1708
-1.1708
1.0000
p =
-7.8541
-1.1459
0
k =
[]
From which I can write:
sym s
F = 0.1708/(s+7.8541) -1.1459/(s+1.1708) + 1/s;
ilaplace(F)
which gives the result:
ans =
(427*exp(-(78541*t)/10000))/2500 - (11459*exp(-(2927*t)/2500))/10000 + 1
which is the answer I want!
But there has to be a better way of doing this! Can someone please advise?
댓글 수: 0
채택된 답변
Star Strider
2019년 11월 6일
Try this:
syms s t
num = 9;
denom = [1 9 9 0];
% [r,p,k] = residue(num,denom);
nums = num;
dens = poly2sym(denom, s); % Create Symbolic Polynomial
F = nums / dens * 1/s % Transfer Function With Step Input
Fpf = partfrac(F) % Partial Fraction Expansion
f = ilaplace(Fpf) % Time Domain Expression
f = rewrite(f, 'exp') % Rewrite As Exponential Terms
f = vpa(f,4) % Convert Fractions To Decimal Equivalents
flatex = latex(f) % LaTeX Expression
producing:
댓글 수: 2
Star Strider
2019년 11월 7일
As always, my pleasure!
The partfrac function was introduced in R2015a, and seems to be invoked automatically in the last two or three releases. It was not automatic before then, so I specifically included it here.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!