Rename the variable in the cheb2mag function. It was overriding a Scilab function... 78/10778/2
Sylvestre Ledru [Mon, 11 Mar 2013 16:14:39 +0000 (17:14 +0100)]
Change-Id: Ia957602080c696b2a129d1f0bc49fb217fce91f7

scilab/modules/signal_processing/help/en_US/filters/cheb2mag.xml
scilab/modules/signal_processing/macros/cheb2mag.sci

index b5127dd..ddb6a27 100644 (file)
         <title>Examples</title>
         <programlisting role="example"><![CDATA[ 
 //Chebyshev; ripple in the stopband
-n=10;omegar=6;A=1/0.2;samples=0.0001:0.05:10;
+n=10;
+omegar=6;
+A=1/0.2;
+samples=0.0001:0.05:10;
 h2=cheb2mag(n,omegar,A,samples);
 plot(samples,log(h2)/log(10),'frequencies','magnitude in dB')
 
@@ -70,16 +73,13 @@ attenuation=-log(A*A)/log(10);
 plot2d(samples',attenuation*ones(samples)',[5],"000")
  ]]></programlisting>
         <scilab:image><![CDATA[
-//Chebyshev; ripple in the stopband
 n=10;omegar=6;A=1/0.2;samples=0.0001:0.05:10;
 h2=cheb2mag(n,omegar,A,samples);
 plot(samples,log(h2)/log(10),'frequencies','magnitude in dB')
 
-//Plotting of frequency edges
 minval=(-max(-log(h2)))/log(10);
 plot2d([omegar;omegar],[minval;0],[2],"000");
 
-//Computation of the attenuation in dB at the stopband edge
 attenuation=-log(A*A)/log(10);
 plot2d(samples',attenuation*ones(samples)',[5],"000")
 ]]>     </scilab:image>
index bcfc2cf..f19b2e9 100644 (file)
@@ -4,26 +4,27 @@
 // This file must be used under the terms of the CeCILL.
 // This source file is licensed as described in the file COPYING, which
 // you should have received as part of this distribution.  The terms
-// are also available at    
+// are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-function [h2]=cheb2mag(n,omegar,A,sample)
-//<h2>=cheb2mag(n,omegar,A,sample)
+function [h2]=cheb2mag(n,omegar,A,samplefreq)
+//<h2>=cheb2mag(n,omegar,A,samplefreq)
 //Square magnitude response of a type 1 Chebyshev filter
 //omegar = stopband edge
-//sample = vector of frequencies where the square magnitude
+//samplefreq = vector of frequencies where the square magnitude
 //h2 is desired.
 //  n       :Filter order
 //  omegar  :Cut-off frequency
 //  A       :Attenuation in stop band
-//  sample  :Vector of frequency where cheb2mag is evaluated
+//  samplefreq  :Vector of frequency where cheb2mag is evaluated
 //  h2      :Chebyshev II filter values at sample points
 //
 //!
 
 
-   [n1,n2]=size(sample);
+   [n1,n2]=size(samplefreq);
    un=ones(n1,n2);
    Tn=chepol(n,'x');             //n-th Chebyshev polynomial
-   frd=freq(Tn,1,omegar*un./sample);   //frd=Tn(omegar/sample)
+   frd=freq(Tn,1,omegar*un./samplefreq);   //frd=Tn(omegar/samplefreq)
    h2=un./(un+(A*A-1)*un./real(frd.*frd))
 endfunction
+