bug 11519 : Do not invert the curves order. 63/8263/3
Cedric Delamarre [Mon, 23 Jul 2012 15:53:32 +0000 (17:53 +0200)]
Change-Id: I884fc2a01289c598dbbcde7ced50f635f82f3928

scilab/CHANGES_5.4.X
scilab/modules/cacsd/macros/nyquist.sci
scilab/modules/cacsd/tests/unit_tests/nyquist.dia.ref
scilab/modules/cacsd/tests/unit_tests/nyquist.tst

index 84b1ae7..ee5257b 100644 (file)
@@ -195,6 +195,8 @@ Bug Fixes
 * Bug #11488 fixed - Java exception led to a segfault in -ns mode when entering
                      something in the console.
 
+* Bug #11519 fixed - The colored lines in the legend of nyquist plot were inverted.
+
 
 Known Incompatibilities
 =======================
index 43e7c51..ac3f0d5 100644 (file)
@@ -267,7 +267,7 @@ function nyquist(varargin)
   end;
 
   if comments<>[] then
-    legend(Curves($:-1:1),comments);
+    legend(Curves, comments);
   end
   fig.immediate_drawing=immediate_drawing;
 endfunction
index a9e7599..2e6e1b5 100644 (file)
@@ -52,17 +52,9 @@ function r=checknyquist(Args,leg)
     if or(a.children(1).text<>leg(:)) then r=16;return,end
   end
 endfunction
-s=poly(0,'s')
- s  =
-    s   
+s=poly(0,'s');
 n=1+s;d=1+2*s;
-h=syslin('c',n,d)
- h  =
-    1 + s    
-    -----    
-    1 + 2s   
+h=syslin('c',n,d);
 sl=tf2ss(h);
 sld=dscr(sl,0.01);
 hd=ss2tf(sld);
@@ -152,3 +144,11 @@ if checknyquist(list(sld,0.01,100,0.01)) then bugmes();quit;end
 //nyquist given by precmputed freqency response
 clf(); nyquist(w,rf)
 clf(); nyquist(w,20*log(abs(rf))/log(10),(180/%pi)*atan(imag(rf),real(rf)))
+// check legend color
+clf();
+F1=syslin('c',(2.5*0.8)/((0.25*%s+1)*(0.8*%s+1)));
+F2=syslin('c',(0.88*2.5*0.8)/((0.25*%s+1)*(0.8*%s+1)));
+F3=syslin('c',(100*2.5*0.8)/((0.25*%s+1)*(0.8*%s+1)));
+nyquist ([F1;F2;F3],0.0 ,1000,["F1(Kr=1)";"F2(Kr=0,88)";"F3(Kr=10)"],%f)
+a=gca();
+assert_checkequal(a.children(1).links.foreground, [3, 2, 1]); // [green blue black]
index 83f59d7..5da9571 100644 (file)
@@ -13,7 +13,7 @@ function r=checknyquist(Args,leg)
   [frq,rf,splitf]=repfreq(Args(:));repi=imag(rf);repf=real(rf);
   [mn,n]=size(rf);
   splitf($+1)=n+1;
-  
+
   ksplit=1;sel=splitf(ksplit):splitf(ksplit+1)-1;
   R=[repf(:,sel)];  I=[repi(:,sel)];
   for ksplit=2:size(splitf,'*')-1
@@ -24,12 +24,12 @@ function r=checknyquist(Args,leg)
   //use symetry
   R=[R R(:,$:-1:1)];
   I=[I -I(:,$:-1:1)];
-  
+
   l=find(~isnan(R(1,:)))
   fig=gcf();
   r=0
   a=fig.children;
+
   if a.log_flags<>'nnn' then r=1;return,end
   if or(a.axes_visible<>["on","on","on"]) then r=2;return,end
 
@@ -60,9 +60,9 @@ function r=checknyquist(Args,leg)
 endfunction
 
 
-s=poly(0,'s')
+s=poly(0,'s');
 n=1+s;d=1+2*s;
-h=syslin('c',n,d)
+h=syslin('c',n,d);
 sl=tf2ss(h);
 sld=dscr(sl,0.01);
 hd=ss2tf(sld);
@@ -144,6 +144,15 @@ clf();nyquist(sld,0.01,100,0.01)
 if checknyquist(list(sld,0.01,100,0.01)) then pause,end
 
 //nyquist given by precmputed freqency response
+
 clf(); nyquist(w,rf)
 clf(); nyquist(w,20*log(abs(rf))/log(10),(180/%pi)*atan(imag(rf),real(rf)))
+
+// check legend color
+clf();
+F1=syslin('c',(2.5*0.8)/((0.25*%s+1)*(0.8*%s+1)));
+F2=syslin('c',(0.88*2.5*0.8)/((0.25*%s+1)*(0.8*%s+1)));
+F3=syslin('c',(100*2.5*0.8)/((0.25*%s+1)*(0.8*%s+1)));
+nyquist ([F1;F2;F3],0.0 ,1000,["F1(Kr=1)";"F2(Kr=0,88)";"F3(Kr=10)"],%f)
+a=gca();
+assert_checkequal(a.children(1).links.foreground, [3, 2, 1]); // [green blue black]