필터 지우기
필터 지우기

Error when using residue function

조회 수: 4 (최근 30일)
Luan Nguyen Thanh
Luan Nguyen Thanh 2017년 12월 6일
편집: Luan Nguyen Thanh 2017년 12월 6일
Please tell me if there's something with my code or it just because of the function "residue"
syms z
dz = (2*z + 1)^4*(3*z + 1)^2*(z + 1)^3;
% get all coefficients of the above polynomial, dz (largest degree --> smallest one)
cs = fliplr( double(coeffs(fz)) );
% partial fraction decomposition of "1/dz" using "residue" function
[r,p,k] = residue(1,cs);
The result shows that
p = [-1.0000 -1.0000 -1.0000 -0.5005 -0.5005 -0.4995 -0.4995 -0.3333 -0.3333]
However, should it be like this to be correct? (notice the differences of the 4th-7th elements in two results)
p = [-1.0000 -1.0000 -1.0000 -0.5000 -0.5000 -0.5000 -0.5000 -0.3333 -0.3333]
Also by using r,p,k achieved from "residue" function, I cannot convert the partial fraction expansion back to polynomial coefficients. How can I fix it?
  댓글 수: 2
Jan
Jan 2017년 12월 6일
Please explain, why you assume that the second value of p is correct.
Luan Nguyen Thanh
Luan Nguyen Thanh 2017년 12월 6일
편집: Luan Nguyen Thanh 2017년 12월 6일
I think there are 3 reasons:
1) As explained in "https://www.mathworks.com/help/matlab/ref/residue.html#outputarg_p", p represents the poles of 1/dz, so I think it should be
p = [-1.0000 -1.0000 -1.0000 -0.5000 -0.5000 -0.5000 -0.5000 -0.3333 -0.3333]
2) Same as 1), you can see that -0.5005 and -0.4995 can not be the poles of 1/dz.
3) I explained in my question that with the coefficients "r,p,k" obtained from using residue, I cannot recover the partial fraction expansion to polynomial coefficients, which means when I write:
[r,p,k] = residue(1,cs)
[b2,a2] = residue(r,p,k)
I will get b2 and a2 different from 1 and cs, respectively.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2017년 12월 6일
If you have R2015a or later, use the partfrac (link) function.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by