* Bug 16005 fixed [doc]: intdec() example was biased & not robust
[scilab.git] / scilab / modules / signal_processing / help / en_US / intdec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="intdec">
3     <refnamediv>
4         <refname>intdec</refname>
5         <refpurpose>Changes  sampling rate of a signal</refpurpose>
6     </refnamediv>
7     <refsynopsisdiv>
8         <title>Syntax</title>
9         <synopsis>[y]=intdec(x,lom)</synopsis>
10     </refsynopsisdiv>
11     <refsection>
12         <title>Arguments</title>
13         <variablelist>
14             <varlistentry>
15                 <term>x</term>
16                 <listitem>
17                     <para>input sampled signal</para>
18                 </listitem>
19             </varlistentry>
20             <varlistentry>
21                 <term>lom</term>
22                 <listitem>
23                     <para>
24                         For a 1D signal this is a scalar which gives the rate change. For a 2D signal this is a 2-Vector of sampling rate changes <literal>lom</literal>=(col rate change,row rate change)
25                     </para>
26                 </listitem>
27             </varlistentry>
28             <varlistentry>
29                 <term>y</term>
30                 <listitem>
31                     <para>Output sampled signal</para>
32                 </listitem>
33             </varlistentry>
34         </variablelist>
35     </refsection>
36     <refsection>
37         <title>Description</title>
38         <para>
39             Changes the sampling rate of a 1D or 2D signal by the rates in lom
40         </para>
41     </refsection>
42     <refsection>
43         <title>Examples</title>
44         <programlisting role="example"><![CDATA[
45 Fs1 = 1000;               // initial sampling frequency
46 Fs2 = 1400;               // targeted resampling frequency
47 t1 = linspace(0, 5-1/Fs1, Fs1*5)';
48 t2 = linspace(0, 5-1/Fs2, Fs2*5)';
49 F0 = 2;                    // Signal frequency
50 u1 = sin(2*%pi*F0*t1);
51 u2 = sin(2*%pi*F0*t2);     // Direct sampling at targeted frequency (as reference)
52 u2b = intdec(u1, Fs2/Fs1); // Resampled signal
53 clf
54 plot(t2,u2,"b", t2,(u2b-u2)*1e13, "m");
55 legend("Direct highly sampled u2","Resampling_error x 1e13","in_upper_left");
56  ]]></programlisting>
57         <scilab:image>
58             Fs1 = 1000;               // initial sampling frequency
59             Fs2 = 1400;               // targeted resampling frequency
60             t1 = linspace(0, 5-1/Fs1, Fs1*5)';
61             t2 = linspace(0, 5-1/Fs2, Fs2*5)';
62             F0 = 2;                    // Signal frequency
63             u1 = sin(2*%pi*F0*t1);
64             u2 = sin(2*%pi*F0*t2);     // Direct sampling at targeted frequency (as reference)
65             u2b = intdec(u1, Fs2/Fs1); // Resampled signal
66             clf
67             plot(t2,u2,"b", t2,(u2b-u2)*1e13, "m");
68             legend("Direct highly sampled u2","Resampling_error x 1e13","in_upper_left");
69         </scilab:image>
70     </refsection>
71 </refentry>