<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 29/10/2014 17:01, Tin Nguyen a
écrit :<br>
</div>
<blockquote cite="mid:002101cff391$9f849ef0$de8ddcd0$@gmail.com"
type="cite">
<pre wrap="">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</pre>
</blockquote>
Take care that the Matlab function residuez does not produce exactly
the same thing<br>
first the residuez help pages states<br>
"<font color="#3366ff"><i>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. </i></font>"<br>
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. <br>
<br>
If you do something like<br>
P=poly(ones(1,6),'x','r') //(x-1)^6<br>
r=roots(P);<br>
clf;plot(real(r),imag(r),'*')<br>
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<br>
<br>
As noticed in the residuez help page <b>the problem is ill-posed</b><br>
to be convinced just compute the fraction decomposition of 1/(z-1)^6
using residuez and computing back the fraction<br>
>> [r,p,k]=residuez(1,poly(ones(1,6)));<br>
<br>
>> [b,a]=residuez(r,p,k)<br>
b =<br>
1.0e+07 *<br>
Columns 1 through 4<br>
-0.5038 + 0.0008i 2.5335 - 0.0041i -5.0956 + 0.0081i 5.1243 -
0.0081i<br>
Columns 5 through 6<br>
-2.5765 + 0.0040i 0.5182 - 0.0008i<br>
a =<br>
1.0000 -6.0000 15.0000 -20.0000 15.0000 -6.0000
1.0000<br>
<br>
<br>
<b>The problem is ill-posed,</b> <b>so it should be better to avoid
its use</b> . What is the problem you want to solve?<br>
Serge Steer<br>
<blockquote cite="mid:002101cff391$9f849ef0$de8ddcd0$@gmail.com"
type="cite">
<pre wrap="">
-----Original Message-----
From: users [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>] On Behalf Of Serge Steer
Sent: Thursday, October 23, 2014 2:22 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
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 :
</pre>
<blockquote type="cite">
<pre wrap="">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
</pre>
</blockquote>
<pre wrap="">poles.
</pre>
<blockquote type="cite">
<pre wrap="">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 [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>] On Behalf Of Serge
Steer
Sent: Tuesday, October 14, 2014 6:36 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
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 :
</pre>
<blockquote type="cite">
<pre wrap="">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:
<a class="moz-txt-link-freetext" href="http://mailinglists.scilab.org/Problem-with-partial-fraction-decompos">http://mailinglists.scilab.org/Problem-with-partial-fraction-decompos</a>
i tion-dfss-tp4031331.html Sent from the Scilab users - Mailing Lists
Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre wrap="">
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>