Bug 11340 fixed: bode, gainplot, nyquist and plzr without args did not show an example 11/7711/9
Calixte DENIZET [Sun, 24 Jun 2012 17:12:17 +0000 (19:12 +0200)]
Change-Id: Ifc95fff11f12bde96f128393cefcef9dae2b0360

scilab/CHANGES_5.4.X
scilab/modules/cacsd/macros/bode.sci
scilab/modules/cacsd/macros/gainplot.sci
scilab/modules/cacsd/macros/nyquist.sci
scilab/modules/cacsd/macros/plzr.sci

index 31fd046..805dc6a 100644 (file)
@@ -400,6 +400,7 @@ CACSD & Signal Processing
 
 * Bug #10562 fixed - The "CACSD/Robust Control" demo failed.
 
+* Bug #11340 fixed - bode, gainplot, nyquist and plzr without arguments did not show an example.
 
 ATOMS
 =======
index 141bafe..fe1cd87 100644 (file)
@@ -8,6 +8,18 @@
 
 function []=bode(varargin)
   rhs=size(varargin)
+
+  if rhs == 0 then
+    s=poly(0,'s')
+    h1=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
+    num=22801+4406.18*s+382.37*s^2+21.02*s^3+s^4;
+    den=22952.25+4117.77*s+490.63*s^2+33.06*s^3+s^4
+    h2=syslin('c',num/den);
+
+    bode([h1;h2],0.01,100,['h1';'h2'])
+    return;
+  end
+
   if type(varargin($))==10 then
     comments=varargin($),rhs=rhs-1;
   else
index 2338b01..96436f2 100644 (file)
@@ -8,6 +8,18 @@
 
 function []=gainplot(varargin)
   rhs=size(varargin)
+
+  if rhs == 0 then
+    s=poly(0,'s');
+    h1=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01));
+    h2=syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225));
+    gainplot([h1;h2],0.01,100,..
+             ["$\frac{s^2+18 s+100}{s^2+6.06 s+102.1}$";
+              "$\frac{s^2+3.02 s+228.01}{s^2+27 s+225}$"]);
+    title('Gainplot');
+    return;
+  end
+
   if type(varargin($))==10 then
     comments=varargin($);
     rhs=rhs-1;
index 2cdf7cd..43e7c51 100644 (file)
@@ -10,6 +10,22 @@ function nyquist(varargin)
 // Nyquist plot
 //!
   rhs=size(varargin);
+
+  if rhs == 0 then
+    //Hall chart as a grid for nyquist
+    s=poly(0,'s');
+    Plant=syslin('c',16000/((s+1)*(s+10)*(s+100)));
+    //two degree of freedom PID
+    tau=0.2;xsi=1.2;
+    PID=syslin('c',(1/(2*xsi*tau*s))*(1+2*xsi*tau*s+tau^2*s^2));
+    nyquist([Plant;Plant*PID],0.5,100,["Plant";"Plant and PID corrector"]);
+    hallchart(colors=color('light gray')*[1 1])
+    //move the caption in the lower rigth corner
+    ax=gca();Leg=ax.children(1);
+    Leg.legend_location="in_upper_left";
+    return;
+  end
+
   symmetry=%t
   if type(varargin(rhs))==4 then //symmetrization flag
     symmetry=varargin(rhs)
index a95bed0..a575363 100644 (file)
@@ -10,6 +10,16 @@ function plzr(a,b,c,d)
 //
 // Copyright INRIA
   [lhs,rhs]=argn(0)
+
+  if rhs == 0 then
+    s=poly(0,'s');
+    n=[1+s, 2+3*s+4*s^2, 5;0, 1-s, s];
+    d=[1+3*s, 5-s^3, s+1;1+s, 1+s+s^2, 3*s-1];
+    h=syslin('c',n./d); 
+    plzr(h);
+    return;
+  end
+
   select typeof(a)
   case 'rational' then
     if rhs<>1 then