7c10d488a2227c5ac9e57d8771e63335509ab250
[scilab.git] / scilab / modules / cacsd / macros / zgrid.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2005 - INRIA - Farid Belahcene
3 // This file must be used under the terms of the CeCILL.
4 // This source file is licensed as described in the file COPYING, which
5 // you should have received as part of this distribution.  The terms
6 // are also available at
7 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
8
9 function []=zgrid()
10         
11         my_figure = gcf();
12         show_window();
13         
14         my_figure.immediate_drawing = "off";
15         
16         square(-1.1,-1.1,1.1,1.1);
17         xtitle( ["loci with constant damping and constant frequencies";"in discrete plane"]," "," ");
18         
19         xsi=0:0.1:1
20         
21         //                           2                 2
22         //roots of                  s  + 2*xsi*w0*s +w0
23         //given by : w0*(-xsi+-%i*sqrt(1-sxi*xsi))
24         
25         raci=((0:0.05:1)*%pi)'*(-xsi+%i*sqrt(ones(xsi)-xsi.*xsi))
26         // continuous --> discrete
27         raci=exp(raci);[mr,nr]=size(raci);
28         for l=1:nr,
29                 xstring(real(raci(mr-10,l)),-imag(raci(mr-10,l)),' '+string(xsi(l)),0,0);
30         end;
31         
32         plot2d(real(raci),imag(raci),1*ones(1,nr),"001");
33         plot2d(real(raci),-imag(raci),1*ones(1,nr),"001");
34         
35         w0=(0:0.1:1)*%pi;
36         e_itheta=exp(%i*(%pi/2:0.05:%pi)')
37         zw=exp(e_itheta*w0);[mz,nz]=size(zw)
38         
39         for l=1:nz,
40                 xstring(real(zw(1,l)),imag(zw(1,l)),' '+string(w0(l)/(2*%pi)),0,0);
41         end;
42         
43         //-- the curves
44         plot2d(real(zw),imag(zw),1*ones(1,nr),"001");
45         plot2d(real(zw),-imag(zw),1*ones(1,nr),"001");
46         
47         my_figure.immediate_drawing = "on";
48         
49 endfunction