Re: [Scilab-users] Bode of discret time transfer function.

2017-02-25 Thread Tim Wescott
Not sure what you're trying to achieve, but if you want a plot of the
linear amplitude response on a linear frequency line, use Horner:

H = syslin('d', (%z - 0.9) / (%z - 99));
th = %pi * (-1:0.01:1)';
clf; plot2d(th, abs(horner(H, exp(%i * th; xgrid(2)

On Sat, 2017-02-25 at 18:17 +, Pablo Fonovich wrote:
> Hi:
> This is the first time i work with discrete time transfers functions
> and Scilab.
> I want to use bode() for plotting the magnitud and phase response of
> the system, however, i don't understand how to set the frequencies to
> normalized values (-pi, pi).
> This is what i'm doing:
> 
> s=poly(0,'s')
> H=(s^(-2400))/(1-0.5*s^(-2400))
> S=syslin('d',H)
> bode(S)
> 
> i get a warning that frequencies beyond nyquist rate are ignored and
> the resulting plot is attached.
> 
> In the help, it says that bode parameter could include fmin and fmax
> in herz, but isn't a discrete system response limited to normalized
> frequencies? And to transform the normalized frecuency to herz the
> sample rate must be used, but i don't know how to pass it to the
> system or something.
> 
> Any hints would be appreciated.
> Thanks
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Bode of discret time transfer function.

2017-02-25 Thread Tim Wescott
First, 'bode' is going to give you a Bode plot, and it's going to be
insistent on giving it to you in log-log format -- so if you want a
plot on a linear frequency axis from -pi to +pi, then you need to do it
by hand.
Second, 'bode' is pretty insistent about reporting things as per second
-- if you define a system as 'd' then it'll act like the system is
sampled at 1Hz.
If, for instance, you run:
H = syslin('d', (%z - 0.9) / (%z - 1));
g = scf(0); clf; bode(H, 0.001, 0.4999, 'rad')
You will get the following plot:
It puts the vertical red lines there, presumably to mark Nyquist, even
though we're displaying in radians per sample, and it reports things as
radians/s.  You can get into the guts of the graph and fix it up,
though:
delete(g.children(2).children(1));   // Delete the top red line
delete(g.children(1).children(1));   // Delete the bottom red line
g.children(2).x_label.text = "Frequency (rad/sample)";  // Change the
top text
g.children(1).x_label.text = "Frequency (rad/sample)";  // change the
bottom text
Do all this, and you get:
On Sat, 2017-02-25 at 20:38 +0100, Serge Steer wrote:
> Le 25/02/2017 à 19:17, Pablo Fonovich a écrit :
> > Hi:
> > This is the first time i work with discrete time transfers
> > functions and Scilab.
> > I want to use bode() for plotting the magnitud and phase response
> > of the system, however, i don't understand how to set the
> > frequencies to normalized values (-pi, pi).
> > This is what i'm doing:
> > 
> > s=poly(0,'s')
> > H=(s^(-2400))/(1-0.5*s^(-2400))
> > S=syslin('d',H)
> > bode(S)
> > 
> > i get a warning that frequencies beyond nyquist rate are ignored
> > and the resulting plot is attached.
> > 
> > In the help, it says that bode parameter could include fmin and
> > fmax in herz, but isn't a discrete system response limited to
> > normalized frequencies? And to transform the normalized frecuency
> > to herz the sample rate must be used, but i don't know how to pass
> > it to the system or something.
>  S=syslin(dt,H) defines a dynamical system sampled. dt beeing the
> sampling period in second.
> If you want the frequency uniis be in rd/s add "rad" as last input
> argument
> > Any hints would be appreciated.
> > Thanks
> > 
> > 
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Bode of discret time transfer function.

2017-02-25 Thread Serge Steer

Le 25/02/2017 à 19:17, Pablo Fonovich a écrit :


Hi:

This is the first time i work with discrete time transfers functions 
and Scilab.


I want to use bode() for plotting the magnitud and phase response of 
the system, however, i don't understand how to set the frequencies to 
normalized values (-pi, pi).


This is what i'm doing:


s=poly(0,'s')
H=(s^(-2400))/(1-0.5*s^(-2400))
S=syslin('d',H)
bode(S)


i get a warning that frequencies beyond nyquist rate are ignored and 
the resulting plot is attached.



In the help, it says that bode parameter could include fmin and fmax 
in herz, but isn't a discrete system response limited to normalized 
frequencies? And to transform the normalized frecuency to herz the 
sample rate must be used, but i don't know how to pass it to the 
system or something.


S=syslin(dt,H) defines a dynamical system sampled. dt beeing the 
sampling period in second.

If you want the frequency uniis be in rd/s add "rad" as last input argument


Any hints would be appreciated.

Thanks



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Bode of discret time transfer function.

2017-02-25 Thread Pablo Fonovich
Hi:

This is the first time i work with discrete time transfers functions and Scilab.

I want to use bode() for plotting the magnitud and phase response of the 
system, however, i don't understand how to set the frequencies to normalized 
values (-pi, pi).

This is what i'm doing:


s=poly(0,'s')
H=(s^(-2400))/(1-0.5*s^(-2400))
S=syslin('d',H)
bode(S)


i get a warning that frequencies beyond nyquist rate are ignored and the 
resulting plot is attached.

[cid:4845973f-0da4-4dd3-ade0-64a7e55422d3]

In the help, it says that bode parameter could include fmin and fmax in herz, 
but isn't a discrete system response limited to normalized frequencies? And to 
transform the normalized frecuency to herz the sample rate must be used, but i 
don't know how to pass it to the system or something.


Any hints would be appreciated.

Thanks
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Curing scf() & figure() slowliness: a good target for Scilab 6.0.1

2017-02-25 Thread Samuel Gougeon

Hello,

Opening a new empty figure (without drawing anything) is a so common 
elementary task and it has become so long that i have built a short 
benchmark about it from Scilab 4.1.2 to Scilab 6.0.

Detailed results are here-below. The main conclusions are the following:

1. with no pre-existing figure,*scf**() is **20 times slower in **5.5
   and 6.0 than in *its best performances in *5.3.0*. On my computer,
   it takes 0.062 s with 5.3.0 and 1.3 s now (5.5.2|6.0).
   Scilab 5.4.0, 5.4.1 and 5.5.0 have dramatically damaged performances.
   The loss is even 10x bigger with figure(): it is ~200 times slower
   with Scilab 5.5 & 6.0 than with Scilab 4.1.2

2. Since Scilab 5.5.0, the time taken to open a new figure increases
   linearly with the number of already opened figures. On my computer,
   opening the first one (after loading scf()) takes 1.8 s, and opening
   the 20th one takes almost 10 s. This is still the case with Scilab 6.0.

*Detailled results: *

1. Opening the first figure :
   Only 2 tests are reported with figure() instead of scf().

   t=0;  for  i=1:50,  tic();  scf();  t=t+toc();  xdel();  end;  t,  t/50
 [s]  [s]  4.1.2 base  figure()
   6.0.0  :  62.39/50   1.24818.5 2.32
   5.5.2  :  73.62/50   1.4723   21.8
   5.5.0  :  69.94/50   1.3988   20.8
   5.4.1  :  37.33/50   0.7466   11.1
   5.4.0  :  24.07/50   0.4814   7.14
   5.3.0  :  3.102/50   0.0620   0.92
   5.1.0  :  4.069/50   0.0814   1.21
   4.1.2  :  3.370/50   0.0674   1.00 0.014

2. Opening 20 figures :

   t=[];  for  i=1:20,  tic();  scf();  t(i)=toc();  end;  sum(t)/20

   6.0.0  :  5.30  [1.35  =>  9.51]
   5.5.2  :  5.68  [1.77  =>  9.92]
   5.5.0  :  5.66  [1.82  =>  9.85]  range from the #1 to #20
   5.4.1  :  1.18
   5.4.0  :  0.923
   5.3.0  :  0.110
   5.1.0  :  
   4.1.2  :  0.0774 


Samuel

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users