Fw: What's wrong with this?

Glauco Masotti glauco.masotti at alice.it
Tue Sep 15 10:28:51 CEST 2009


Hello. Not receiving answer from the support team, and as suggested in an autoreply mail from scilab at inria.fr  (as well as from Antonelli),
I am forwarding you the following message, hoping that someone of you can give me insight on this issue, 
and perhaps of contributing to the improvement of the program.
Best regards,
--- Glauco Masotti


----- Original Message ----- 
From: Glauco Masotti 
To: scilab.support at scilab.org ; scilab at inria.fr ; antonelli at unicas.it ; chiaverini at unicas.it 
Sent: Sunday, September 13, 2009 6:26 PM
Subject: What's wrong with this?


Hello.
I intended to use Scilab to design a digital filter for a critical application.
I am new to your program, thus I went trough the documents available from your website: "Introduction to Scilab" and "Signal Processing with Scilab". 
I also found help in the document by Antonelli and Chiaverini: "Introduzione a SCILAB 5.1", in Italian.

I made some experiments  with a relatively simple filter architecture, conceived as the double difference of two couples of one pole filters, i.e.:
H(z) = (m4 - m3) - (m2 - m1), where each mi = ai/(1-(1-ai)z^-1) is a filter with one real pole for z=ai (i.e. an exponential moving average).
I derived the exact transfer function crunching the algebra, which I reported in the attached document "True0s.gif" . 
This is a screen shot of the program Graph, by Ivan Johansen, which I used to find out where the true zeros of H(z) are located. 
The attached documents report the case a1=0.99, a2= 0.98, a3=0.97, a4=0.95.
By inspection of H(z) it can be seen that, besides a double 0 for z=0, it has a zero for z=1, and, observing the graph of the second order polynomial term, 
there are two real zeros close to the origin (at about -0.045 and 0.025). It's also clear that H(z) preserves the poles at their original locations, i.e. for z=a1, a2, a3, a4. 

The results which can be found using Scilab are very much different! They are reported and summarized in the attached documents "diff-diff.log" and "plzr(diff_diff)(0).gif".
According to Scilab the filter has only 3 poles, thus a pole (at 0.98) has been canceled with a zero, 
and the location of poles is somewhat different from the original locations, with differences up to 0.3%. 
The locations of zeros is even more surprising! There is an error of 0.1% for the zero located at 1, plus a zero at 1.0446 is found, very far from the true zeros, 
and also suggesting the filter is not minimum phase!

The file "diff2-diff1.log" reports a variation on the theme, where the magnitude response of the various filters is normalized for a peak of 1. 
The response of these filters is shown in "diff2-diff1.gif". 
The green line should represent the correct response of the double difference filter, as found by feeding Graph with the basic expressions, 
whereas the blue line represent the response of the filter outputted by Scilab. 
The response of the two filters is almost identical for x (the normalized frequency) > 0.01, but is rather different at lower frequencies.

Well, I  may have been fooled by something, but can't see what, so I assume that my algebra is correct. The results of Graph also contradict the output from Scilab.

Therefore, how comes there are such big differences and manifestly wrong results are found?
Did I made something wrong in using Scilab? Or did I hit a bug of the program?
It doesn't look a problem of numerical inaccuracy, the filter is relatively simple and the errors are too big.
I hope you can give me advice to deal with this, otherwise I will be forced not to use Scilab and I will have much more work to do by using other means.

Best regards,
--- Glauco Masotti
Ravenna, ITALY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20090915/278636c9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: True0s.gif
Type: image/gif
Size: 30193 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20090915/278636c9/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff-diff.log
Type: application/octet-stream
Size: 1099 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20090915/278636c9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plzr(diff_diff)(0).gif
Type: image/gif
Size: 22577 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20090915/278636c9/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff2-diff1.log
Type: application/octet-stream
Size: 1126 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20090915/278636c9/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff2-diff1.gif
Type: image/gif
Size: 47208 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20090915/278636c9/attachment-0002.gif>


More information about the users mailing list