bug 6635 fix 55/155/1
Serge Steer [Fri, 16 Apr 2010 12:59:17 +0000 (14:59 +0200)]
Change-Id: Ie9b74e844b2edec7057ef285d6b6d29553b06d25

scilab/CHANGES_5.3.X
scilab/modules/cacsd/macros/calfrq.sci
scilab/modules/cacsd/tests/nonreg_tests/bug_6635.dia.ref [new file with mode: 0644]
scilab/modules/cacsd/tests/nonreg_tests/bug_6635.tst [new file with mode: 0644]

index 3edd61b..b83bcdc 100644 (file)
@@ -187,6 +187,8 @@ Bug fixes:
 * bug 6556 fixed - fprintf() returned an error if it's called 2 times (or more)
                    on the same file.
 
+* bug 6635 fixed - Incorrectly drawn Bode plots (calfrq bug).
+
 * bug 6682 fixed - mprintf, msprintf, mfprintf did not manage octal (%o) format.
 
 * bug 6740 fixed - It was not possible to launch Scilab as Minimized 
index 9b99a42..b28f616 100644 (file)
@@ -133,7 +133,7 @@ function [frq,bnds,splitf]=calfrq(h,fmin,fmax)
     sing=[sing;%sel(roots(denh(i)),fmin,fmax,tol)];
   end
 
-  pp=gsort(sing');npp=size(pp,'*');//'
+  pp=gsort(sing','g','i');npp=size(pp,'*');//'
 
   // singularities just on the left of the range
   kinf=find(pp<fmin)
diff --git a/scilab/modules/cacsd/tests/nonreg_tests/bug_6635.dia.ref b/scilab/modules/cacsd/tests/nonreg_tests/bug_6635.dia.ref
new file mode 100644 (file)
index 0000000..aab1d59
--- /dev/null
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - INRIA - Serge Steer
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 6635 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6635
+//
+// <-- Short Description -->
+//  Incorrectly drawn Bode plots (calfrq bug).
+num=real(poly([0.75788802401980426;-0.74488662950015194;0.71042740727148268+%i*0.32150242887306801;
+              0.71042740727148268-%i*0.32150242887306801;0.88108463001435433;
+              0.65688756930625614+%i*0.70651639282163481;0.65688756930625614-%i*0.70651639282163481;
+              0.87396240470428910+%i*0.38544888973757035;0.87396240470428910-%i*0.38544888973757035;
+              0.96638845127253781+%i*0.20986303449468094;0.96638845127253781-%i*0.20986303449468094;
+              0.99463810059227120+%i*0.1259837606842592;0.99463810059227120-%i*0.1259837606842592;
+              -8.33517712317947712],'z'));
+den=real(poly([0.44209498830922006+%i*0.58376435045145136;0.44209498830922006-%i*0.58376435045145136;
+              0.74984178464015416+%i*0.23826316198364383;0.74984178464015416-%i*0.23826316198364383;
+              0.88908657183242579;0.78005500218689083;0.73910333806015660+%i*0.66143232274074371;
+              0.73910333806015660-%i*0.66143232274074371;0.91630828475086279+%i*0.37654428560847641;
+              0.91630828475086279-%i*0.37654428560847641;0.97669896242019394+%i*0.19145035111644124;
+              0.97669896242019394-%i*0.19145035111644124;0.98956694435920334+%i*0.09896014014807389;
+              0.98956694435920334-%i*0.09896014014807389],'z'));
+[frq,bnds,splitf]=calfrq(rlist(num,den,0.00999897500976181),1,10);
+if or(diff(frq)<0) then bugmes();quit;end
diff --git a/scilab/modules/cacsd/tests/nonreg_tests/bug_6635.tst b/scilab/modules/cacsd/tests/nonreg_tests/bug_6635.tst
new file mode 100644 (file)
index 0000000..d563c57
--- /dev/null
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - INRIA - Serge Steer
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 6635 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6635
+//
+// <-- Short Description -->
+//  Incorrectly drawn Bode plots (calfrq bug).
+
+num=real(poly([0.75788802401980426;-0.74488662950015194;0.71042740727148268+%i*0.32150242887306801;
+              0.71042740727148268-%i*0.32150242887306801;0.88108463001435433;
+              0.65688756930625614+%i*0.70651639282163481;0.65688756930625614-%i*0.70651639282163481;
+              0.87396240470428910+%i*0.38544888973757035;0.87396240470428910-%i*0.38544888973757035;
+              0.96638845127253781+%i*0.20986303449468094;0.96638845127253781-%i*0.20986303449468094;
+              0.99463810059227120+%i*0.1259837606842592;0.99463810059227120-%i*0.1259837606842592;
+              -8.33517712317947712],'z'));
+
+
+
+den=real(poly([0.44209498830922006+%i*0.58376435045145136;0.44209498830922006-%i*0.58376435045145136;
+              0.74984178464015416+%i*0.23826316198364383;0.74984178464015416-%i*0.23826316198364383;
+              0.88908657183242579;0.78005500218689083;0.73910333806015660+%i*0.66143232274074371;
+              0.73910333806015660-%i*0.66143232274074371;0.91630828475086279+%i*0.37654428560847641;
+              0.91630828475086279-%i*0.37654428560847641;0.97669896242019394+%i*0.19145035111644124;
+              0.97669896242019394-%i*0.19145035111644124;0.98956694435920334+%i*0.09896014014807389;
+              0.98956694435920334-%i*0.09896014014807389],'z'));
+
+
+[frq,bnds,splitf]=calfrq(rlist(num,den,0.00999897500976181),1,10);
+if or(diff(frq)<0) then pause,end