[Scilab-users] New problems with "freson" in CACSD module Classic List Threaded 2 messages  Hello all ! I believe that there are new problems with "freson.sci" program in CACSD module. If you are running two programs, one for continuous system another for sampled system, sometimes you have a result as [ ] : you must improve the accuracy of result ;("ffreson.sci" program is proposed). (Bugs not bugs ???? yes bugs : see in text REMARK. 1 . Example : continuous system.     s=%s ; num = s+1.4*s^2+1.4*s^3+0.4*s^4 ; den = 0.5+0.8*s+1.4*s^2+1.4*s^3+0.4*s^4 ;     h = syslin("c",num,den)     fr = freson(h)     fr =          []     gainplot(h,0.01,1)     with my new function "ffreson.sci" :     ffreson(h)//La nouvelle fonction.     ans  =              0.111164226146 2 . Example : sampled system.     The exercise in "help" page of "freson" with sampling period Ts=0.01s : the program gives "fr=[]" .     With sampling period Ts=0.04s you have a good result (problem of accuracy) : run the example in help     and change sampling period. 3 . My opinion and the proposed solutions.     - For continuous system :     If you calculated the function "h(s)*h(-s)" by convolution, the result, as I mentioned before,     must be an even rational : with "horner" it's not, but by convolution the result is OK. (take a look on "ffreson" program :     you find a program "hps_hms" which gives "h(s)*h(-s)" by convolution).     - After that, the numerator of "h(s)*h(-s)"derivative is calculated, this polynomial "der" must be odd (s=0 is a particular root of "der" which   corresponds to zero frequency). If you excluded this root from "der", the new polynomial is even, and you can solve      the finding roots problem with a new polynomial in u=s*s as variable.If "rac" is the vector of square roots of this new polynomial, the vector "r", roots of "der", is r=[rac;-rac;0]. You divide by two the degree of "der" and increase the accuracy      of the result : I use this method in my program.      REMARK : If you run "freson" and "ffreson", step by step, when you calculated the roots of derivatives, the number of roots are not the same !!!  (see "Exemple freson.pdf").      - For sampled system :      - We calculated the function "hh=h(z)*h(1/z)", also with convolution, the result of convolution gives for coefficients vectors      of "hh" a symmetric vector [c1,c2, ....cn], (for numerator and denominator), c1=cn, c2=c(n-1) etc ....see "hpz_hiz" at the end of function "ffreson.sci".      - After that we take account of "z^(degree(h.num)-degree(h.den)) in "hh", and calculated the numerator of derivative of new      "hh".      - Like for continuous system, you excluded "z=1" and "z=-1", which corresponds to frequencies f0=0 and f1=1/*(2*ts) (Nyquist frequency).      - At the end you calculated the roots "r" of new polynomial (the degree of polynomial decreases by two) . A "good" solution must respect "rp=exp(%i*%pi*fp*ts)"; so |rp|=1 and fp>0. The end of my new program is the same as "freson.sci".      I use those methods in the new program "ffreson.sci".      REMARK : the same.      Yours sincerely      [hidden email]      PS      I attached the new function "ffreson.sci" and a report ("Exemples freson.pdf", sorry in french language) to my email.      In "ffreson" you have two functions "hps_hms" for h(s)*h(-s) and  "hpz_hiz" for h(z)*h(1/z).      This program "ffreson" can be used for "iodelay systems", and " hps_hms" , "hpz_hiz" used in m_margin and p_margin      to improve the accuracy of results. _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users Exemples freson.pdf (61K) Download Attachment ffreson.sci (9K) Download Attachment Thanks Lucien, however, to complete the task, you should first reopen bug #15368 at https://bugzilla.scilab.org/show_bug.cgi?id=15368 S. Can you create a bug Le 25/09/2019 à 16:06, lucien.povy a écrit : Hello all ! I believe that there are new problems with "freson.sci" program in CACSD module. If you are running two programs, one for continuous system another for sampled system, sometimes you have a result as [ ] : you must improve the accuracy of result ;("ffreson.sci" program is proposed). (Bugs not bugs ???? yes bugs : see in text REMARK. 1 . Example : continuous system.    s=%s ; num = s+1.4*s^2+1.4*s^3+0.4*s^4 ; den = 0.5+0.8*s+1.4*s^2+1.4*s^3+0.4*s^4 ;    h = syslin("c",num,den)    fr = freson(h)    fr =         []    gainplot(h,0.01,1)    with my new function "ffreson.sci" :    ffreson(h)//La nouvelle fonction.    ans  =             0.111164226146 2 . Example : sampled system.    The exercise in "help" page of "freson" with sampling period Ts=0.01s : the program gives "fr=[]" .    With sampling period Ts=0.04s you have a good result (problem of accuracy) : run the example in help    and change sampling period. 3 . My opinion and the proposed solutions.    - For continuous system :    If you calculated the function "h(s)*h(-s)" by convolution, the result, as I mentioned before,    must be an even rational : with "horner" it's not, but by convolution the result is OK. (take a look on "ffreson" program :    you find a program "hps_hms" which gives "h(s)*h(-s)" by convolution).    - After that, the numerator of "h(s)*h(-s)"derivative is calculated, this polynomial "der" must be odd (s=0 is a particular root of "der" which   corresponds to zero frequency). If you excluded this root from "der", the new polynomial is even, and you can solve     the finding roots problem with a new polynomial in u=s*s as variable.If "rac" is the vector of square roots of this new polynomial, the vector "r", roots of "der", is r=[rac;-rac;0]. You divide by two the degree of "der" and increase the accuracy     of the result : I use this method in my program.     REMARK : If you run "freson" and "ffreson", step by step, when you calculated the roots of derivatives, the number of roots are not the same !!!  (see "Exemple freson.pdf").     - For sampled system :     - We calculated the function "hh=h(z)*h(1/z)", also with convolution, the result of convolution gives for coefficients vectors     of "hh" a symmetric vector [c1,c2, ....cn], (for numerator and denominator), c1=cn, c2=c(n-1) etc ....see "hpz_hiz" at the end of function "ffreson.sci".     - After that we take account of "z^(degree(h.num)-degree(h.den)) in "hh", and calculated the numerator of derivative of new     "hh".     - Like for continuous system, you excluded "z=1" and "z=-1", which corresponds to frequencies f0=0 and f1=1/*(2*ts) (Nyquist frequency).     - At the end you calculated the roots "r" of new polynomial (the degree of polynomial decreases by two) . A "good" solution must respect "rp=exp(%i*%pi*fp*ts)"; so |rp|=1 and fp>0. The end of my new program is the same as "freson.sci".     I use those methods in the new program "ffreson.sci".     REMARK : the same.     Yours sincerely     [hidden email]     PS     I attached the new function "ffreson.sci" and a report ("Exemples freson.pdf", sorry in french language) to my email.     In "ffreson" you have two functions "hps_hms" for h(s)*h(-s) and  "hpz_hiz" for h(z)*h(1/z).     This program "ffreson" can be used for "iodelay systems", and " hps_hms" , "hpz_hiz" used in m_margin and p_margin     to improve the accuracy of results. _______________________________________________ users mailing list [hidden email] https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users -- Stéphane Mottelet Ingénieur de recherche EA 4297 Transformations Intégrées de la Matière Renouvelable Département Génie des Procédés Industriels Sorbonne Universités - Université de Technologie de Compiègne CS 60319, 60203 Compiègne cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users