How to define partial fraction expansion?
62 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
I would like to expand the development of the partial fractions of a function F starting from [r,p,k] = residue(F).
Is there a function that allows you to do this?
2 件のコメント
Dyuman Joshi
2023 年 9 月 5 日
"I would like to explain the development of the partial fractions of a function F starting from [r,p,k] = residue(F)."
What exactly do you mean by "explain the developement"?
回答 (4 件)
Dyuman Joshi
2023 年 9 月 5 日
"I would see the function:
F_residue = 1 - 3/(s+2)
so as a sum of terms"
One method would be to use symbolic variables (Note - requires symbolic toolbox) -
s =tf('s');
F1 = (s-1)/(s+2);
F_res1 = expr(F1)
F2 = (-4*s+8)/(s^2+6*s+8);
F_res2 = expr(F2)
function F_res = expr(F)
N_f = F.Numerator{1};
D_f = F.Denominator{1};
[r,p,k] = residue(N_f,D_f);
syms s
if isempty(k)
k=0;
end
F_res = k + sum(r./(s-p));
end
4 件のコメント
Dyuman Joshi
2023 年 9 月 9 日
Sorry for the late reply, I did not get the notification for your reply somehow.
You are right, I did not incorporate poles with multiplicity more than 1.
%Directly use partfrac
syms s
F = (s-4)/(s*(s+2)^2);
out = partfrac(F)
%or via transfer function
s = tf('s');
F = (s-4)/(s*(s+2)^2);
N_f = F.Numerator{1};
D_f = F.Denominator{1};
n = numel(N_f);
syms s
F0 = (s.^(n-1:-1:0)*N_f')/(s.^(n-1:-1:0)*D_f')
out0 = partfrac(F0)
Ayush Anand
2023 年 9 月 5 日
Hi Mir,
I understand you are looking for a function that can compute the partial fraction decomposition of a function. MATLAB provides a function called "residue" that can be used for this purpose. The "residue" function takes the coefficients of the numerator and denominator polynomials of the rational function as inputs and returns the residues, poles, and constant term of the partial fraction expansion.
You can read more about the syntax and use cases of "residue" here:
I hope this helps!
0 件のコメント
Shubham
2023 年 9 月 5 日
Hi,
MATLAB provides a function called residue that can be used to perform partial fraction decomposition of a rational function. The residue function calculates the residues and poles of a given function.
To read more about residue, refer to this documentation.
Hope this helps. Thanks
0 件のコメント
John D'Errico
2023 年 9 月 5 日
編集済み: John D'Errico
2023 年 9 月 5 日
You already know about the existence of the function residue.m.
Therefore your question is truly to "explain the development" of that partial fraction expansion. For that, you can read the docs surrounding residue, thus by reading here: residue.
You might look at the code itself in the function residue. If you do that, then PLEASE, PLEASE, DO NOT EDIT THE FUNCTION. We see so many times where some one has edited a MATLAB supplied function, and not reaizing they did so, make some silly edit to the code by accident, and then save the function. If you want to look at the code, then do this:
type residue
However, my guess is you won't get far there, as the code has a lot in it, and is probably not illuminating. A new user to MATLAB will just find themselves confused.
Or, you might want to do some reading, to understand how a partial fraction expansion is performed. Maybe start here in the reference provided in residue itself:
Reference: A.V. Oppenheim and R.W. Schafer, Digital
Signal Processing, Prentice-Hall, 1975, p. 56-58.
Or you might look here:
But I'm afraid, if by "explain" you want something that will take you step by step through the specific mathematical computations that were performed, there is no tool in MATLAB that will do that, thus teaching you how to perform a specific partial fraction expansion on some specific problem. (I think Mathematica/Alpha will do things like that, for at least some problems, but I don't use that tool.)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!