[Scilab-users] Problem with partial fraction decomposition (dfss)
tinnguyen
nguyenthientin at gmail.com
Thu Oct 30 04:04:03 CET 2014
I do agree with you. That probably depends on kind of algorithm that
function implements.
Actually, I am a teaching assistant in Digital Signal Processing course. I
try to get benefit from Scilab to do invert z-Transform.
Specifically, given a rational polynomial, I need to decompose it so as some
basic z-Transforms can be applied easily.
I’m very grateful to your help!
Best regard!
Tin Nguyen
From: Serge Steer [via Scilab / Xcos - Mailing Lists Archives]
[mailto:ml-node+s994242n4031450h58 at n3.nabble.com]
Sent: Thursday, October 30, 2014 1:27 AM
To: tinnguyen
Subject: Re: Problem with partial fraction decomposition (dfss)
Le 29/10/2014 17:01, Tin Nguyen a écrit :
Thank you so much, Serge Steer!
Instead of finding a function like 'residuez' in Matlab, now I need to learn
many other things. It's not comfortable.
Hope Scilab will become more convenient for general users like me! :D
Take care that the Matlab function residuez does not produce exactly the
same thing
first the residuez help pages states
"Numerically, the partial fraction expansion of a ratio of polynomials is an
ill-posed problem. If the denominator polynomial is near a polynomial with
multiple roots, then small changes in the data, including roundoff errors,
can cause arbitrarily large changes in the resulting poles and residues. You
should use state-space (or pole-zero representations instead. "
Moreover this function gives you the residual and you have to decide if some
roots are equal or not, to be able to compute the fraction decomposition and
this is not a simple thing to do.
If you do something like
P=poly(ones(1,6),'x','r') //(x-1)^6
r=roots(P);
clf;plot(real(r),imag(r),'*')
You can observe that the roots are not exactly equal to one but located on a
circle of radius approx %eps^(1/6)~=0.002
As noticed in the residuez help page the problem is ill-posed
to be convinced just compute the fraction decomposition of 1/(z-1)^6 using
residuez and computing back the fraction
>> [r,p,k]=residuez(1,poly(ones(1,6)));
>> [b,a]=residuez(r,p,k)
b =
1.0e+07 *
Columns 1 through 4
-0.5038 + 0.0008i 2.5335 - 0.0041i -5.0956 + 0.0081i 5.1243 - 0.0081i
Columns 5 through 6
-2.5765 + 0.0040i 0.5182 - 0.0008i
a =
1.0000 -6.0000 15.0000 -20.0000 15.0000 -6.0000 1.0000
The problem is ill-posed, so it should be better to avoid its use . What is
the problem you want to solve?
Serge Steer
-----Original Message-----
From: users [[hidden email]] On Behalf Of Serge Steer
Sent: Thursday, October 23, 2014 2:22 AM
To: [hidden email]
Subject: Re: [Scilab-users] Problem with partial fraction decomposition
(dfss)
Now you are using a too big value for rmax
-->pf = pfss(h)
pf =
pf(1)
0.75 - 0.25s
------------
2
1 - 2s + s
pf(2)
0.25
----
1 + s
Some explanation
pfss converts the transfer function to state space representation and then
trie to diagonalize the state matrix using the bdiag function
-->S=tf2ss(h);
-->bdiag(S.A)
ans =
1.0000000 - 1.2247449 0.
0. 1. 0.
0. 0. - 1.
You can see with result above that there is a 2 by 2 jordan block (for the
eigenvalue 1) which exhibits a coupling between the two states Now with
-->bdiag(S.A,1/%eps)
ans =
1.0000000 0. 0.
0. 1. 0.
0. 0. - 1.
The Jordan block has been broken
[Ab,X]=bdiag(S.A,1/%eps);cond(X)
ans =
5.074D+14
bdiag has broken the jordan block using a singular "base change" so the
decomposition is a non-sense.
Serge Steer
Le 21/10/2014 12:07, Tin Nguyen a écrit :
Dear Serge Steer,
Thank you very much for your response. Your code works fine.
However, I still have some problem with this pfss function. For
example, I try to decompose a fractional polynomial that has multi-order
poles.
H(z) = 1 / { (1-s)^2 * (1+s) }
You can find following from my console:
-->s = poly(0,'s');
-->h = 1 / ( (1 + s) * (1 - s)^2)
h =
1
-------------
2 3
1 - s - s + s
-->pf = pfss(h, 1/%eps)
pf =
pf(1)
- 9420237.9
-------------
- 1.0000000 + s
pf(2)
9420237.6
---------
- 1 + s
pf(3)
0.25
----
1 + s
I also checked:
-->pf(1)+pf(2)
ans =
0.75 - 0.25s
------------
2
1 - 2s + s
I have no idea about this situation.
Can you help me out! Thank you in advance!
--Tin Nguyen
-----Original Message-----
From: users [[hidden email]] On Behalf Of Serge
Steer
Sent: Tuesday, October 14, 2014 6:36 PM
To: [hidden email]
Subject: Re: [Scilab-users] Problem with partial fraction
decomposition
(dfss)
You just need to tune the rmax optionnal parameter pf =
pfss(tf2ss(hz),5);length(pf)
Serge Steer
Le 13/10/2014 10:12, tinnguyen a écrit :
Hi guys,
I'm having trouble using scilab's function pfss to decompose a
polynomial in order to do inverse Z transform. Following is my code:
--> z = poly(0,'z')
--> hz = z^2 / (1 - 6*z + 11*z^2 - 6*z^3) pf = pfss(tf2ss(hz))
--> length(pf)
The fourth command returns '1'. However, I believe it should be 3. I
also did the decomposition manually and got the result as: hz =
0.5/(1-z) + -1 /
(1-2*z) + 0.5/(1-3*z).
Nevertheless, if I change the numerator of hz from z^2 to z or z^3,
pfss works correctly. I definitely have no idea!!!? :D Please take a
look and correct me if i'm wrong.
Thank you so much!
--
View this message in context:
http://mailinglists.scilab.org/Problem-with-partial-fraction-decompos
i tion-dfss-tp4031331.html Sent from the Scilab users - Mailing Lists
Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_____
If you reply to this email, your message will be added to the discussion
below:
http://mailinglists.scilab.org/Problem-with-partial-fraction-decomposition-d
fss-tp4031331p4031450.html
To unsubscribe from Problem with partial fraction decomposition (dfss),
click here
<http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=unsubscribe_b
y_code&node=4031331&code=bmd1eWVudGhpZW50aW5AZ21haWwuY29tfDQwMzEzMzF8LTU4NzI
1MDg3MA==> .
<http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&
id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNames
pace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeN
amespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails
%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML
--
View this message in context: http://mailinglists.scilab.org/Problem-with-partial-fraction-decomposition-dfss-tp4031331p4031451.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20141029/95bf6607/attachment.htm>
More information about the users
mailing list