Typo fixes
[scilab.git] / scilab / modules / signal_processing / help / en_US / fftshift.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="fftshift">
3     <refnamediv>
4         <refname>fftshift</refname>
5         <refpurpose>rearranges the fft output, moving the zero frequency to the center of the spectrum</refpurpose>
6     </refnamediv>
7     <refsynopsisdiv>
8         <title>Syntax</title>
9         <synopsis>y=fftshift(x [,job])</synopsis>
10     </refsynopsisdiv>
11     <refsection>
12         <title>Arguments</title>
13         <variablelist>
14             <varlistentry>
15                 <term>x</term>
16                 <listitem>
17                     <para>real or complex vector or matrix.</para>
18                 </listitem>
19             </varlistentry>
20             <varlistentry>
21                 <term>y</term>
22                 <listitem>
23                     <para>real or complex vector or matrix.</para>
24                 </listitem>
25             </varlistentry>
26             <varlistentry>
27                 <term>job</term>
28                 <listitem>
29                     <para>integer, dimension selection, or string 'all'</para>
30                 </listitem>
31             </varlistentry>
32         </variablelist>
33     </refsection>
34     <refsection>
35         <title>Description</title>
36         <para>
37             If <literal>x</literal> results of an fft computation <literal>y=fftshift(x)</literal> or <literal>y=fftshift(x,"all")</literal> moves the zero frequency component to the center
38             of the spectrum, which is sometimes a more convenient form.
39         </para>
40         <para>
41             If <literal>x</literal> is a vector of size n, y is the vector <literal>x([n/2+1:n,1:n/2])</literal>
42         </para>
43         <para>
44             If <literal>x</literal> is an <literal>m</literal> by <literal>n</literal> matrix <literal>y</literal> is the matrix
45             <literal>x([m/2+1:n,1:m/2],[n/2+1:n,1:n/2])</literal>.
46         </para>
47         <programlisting role="no-scilab-exec"><![CDATA[
48   [x11 x12]                  [x22 x21]
49 x=[       ]        gives   y=[       ]
50   [x21 x22]                  [x12 x11]
51  ]]></programlisting>
52         <para>
53             <literal>y=fftshift(x,n)</literal> makes the swap only along the <literal>n</literal>th dimension
54         </para>
55     </refsection>
56     <refsection>
57         <title>Examples</title>
58         <programlisting role="example"><![CDATA[
59 // Make a signal
60 t=0:0.1:1000;
61 x=3*sin(t)+8*sin(3*t)+0.5*sin(5*t)+3*rand(t);
62 // Compute the fft
63 y=fft(x,-1);
64
65 // Display
66 clf();
67 subplot(2,1,1);plot2d(abs(y))
68 subplot(2,1,2);plot2d(fftshift(abs(y)))
69  ]]></programlisting>
70         <scilab:image>
71             t=0:0.1:1000;
72             x=3*sin(t)+8*sin(3*t)+0.5*sin(5*t)+3*rand(t);
73             y=fft(x,-1);
74             subplot(2,1,1);plot2d(abs(y))
75             subplot(2,1,2);plot2d(fftshift(abs(y)))
76         </scilab:image>
77         <programlisting role="example"><![CDATA[
78 // Make a 2D image
79 t=0:0.1:30;
80 x=3*sin(t')*cos(2*t)+8*sin(3*t')*sin(5*t)+..
81   0.5*sin(5*t')*sin(5*t)+3*rand(t')*rand(t);
82 // Compute the fft
83 y=fft(x,-1);
84
85 // Display
86 clf();
87 xset('colormap',hotcolormap(256))
88 subplot(2,1,1);Matplot(abs(y))
89 subplot(2,1,2);Matplot(fftshift(abs(y)))
90  ]]></programlisting>
91         <scilab:image>
92             t=0:0.1:30;
93             x=3*sin(t')*cos(2*t)+8*sin(3*t')*sin(5*t)+..
94             0.5*sin(5*t')*sin(5*t)+3*rand(t')*rand(t);
95             y=fft(x,-1);
96             xset('colormap',hotcolormap(256))
97             subplot(2,1,1);Matplot(abs(y))
98             subplot(2,1,2);Matplot(fftshift(abs(y)))
99         </scilab:image>
100     </refsection>
101     <refsection role="see also">
102         <title>See Also</title>
103         <simplelist type="inline">
104             <member>
105                 <link linkend="fft">fft</link>
106             </member>
107             <member>
108                 <link linkend="ifftshift">ifftshift</link>
109             </member>
110         </simplelist>
111     </refsection>
112 </refentry>