[scilab-Users] Bode Diagram and how can I plot those functions on different graph windows ?

Reinaldo tiraduvidascefet at yahoo.com
Mon Sep 19 19:37:05 CEST 2011


I try to understand the help of syslin function, but it is hard ! 
 
The description is:
 
State-space representation:  
sl=syslin(dom,A,B,C [,D [,x0] ])                
represents the system :
     
 
s.x  = A.x + B.u
y = C.x + D.u
x(0) = x0
 
I don't know how to correspond those [ [ ] ] to that linear system. In general, I don't know if it is only my opinion,
but to understand what is written in Scilab help needs much energy ! They often are fuzzy and directed to advanced
Scilab users, not for beginners !
 
Tnx.
Reinaldo.

From: Reinaldo <tiraduvidascefet at yahoo.com>
To: "users at lists.scilab.org" <users at lists.scilab.org>
Sent: Monday, September 19, 2011 1:41 PM
Subject: Re: [scilab-Users] Bode Diagram and how can I plot those functions on different graph windows ?


Thank you, Serger !
 
I just did not understand the Scilab functions:H = syslin('c',(s)/(s+1)); // set continuous time [f,y]=repfreq(H,0.001,100);

All best.
Reinaldo.

From: Serge Steer <Serge.Steer at inria.fr>
To: users at lists.scilab.org
Sent: Monday, September 19, 2011 12:49 PM
Subject: Re: [scilab-Users] Bode Diagram and how can I plot those functions on different graph windows ?


Le 19/09/2011 17:06, Reinaldo a écrit : 
/ Define "s" as variable  // (s é um polinômio de raiz zero) s = poly(0,'s'); // Define the transfer function: 
>H = (s)/(s+1); // Define the frequency range (Hz) f = 0.001:0.001:100; // Calculate the frequency-response: 
>y = freq(H.num,H.den,2*%pi*%i*f); // Calculate the absolute value function module: 
>yabs = abs(y); // Calcula the function module in dB ym = 20*log10(abs(y));  
>// Calculate the phase function in degree: yf = (180/%pi)*atan(imag(y), real(y)); // open and clean the graph window xbasc(), // Divide the graph window in three rows: subplot(3,1,1), plot2d('ln',f,yabs,style=2), xgrid(), xtitle("Modulo em valores absolutos da Função de Transferência","Freqüência [Hz]","Módulo em dB"); 
>subplot(3,1,2), plot2d('ln',f,ym,style=2), xgrid(), xtitle("Modulo em dB da Função de Transferência","Freqüência [Hz]","Módulo em dB");  
>subplot(3,1,3), plot2d('ln',f,yf,style=3), xtitle("Fase da Função de Transferência","Freqüência [Hz]","Fase em Graus"); xgrid();  
You can modify the margins properties for that 
Note that you can use repfreq to compute the frequency dicretisation
    and the frequency response
the following code pllies both solutions 



// Define "s" as variable 
// (s é um polinômio de raiz zero)
s = poly(0,'s');
// Define the transfer function:
H = syslin('c',(s)/(s+1)); // set continuous time
[f,y]=repfreq(H,0.001,100);

// Calculate the absolute value function module:

yabs = abs(y); 
// Calcula the function module in dB
ym = 20*log10(abs(y));

// Calculate the phase function in degree:
yf = (180/%pi)*atan(imag(y), real(y));

// open and clean the graph window
clf(),
// Divide the graph window in three rows:
subplot(3,1,1),
plot2d('ln',f,yabs,style=2),
ax=gca();
ax.margins(3:4)=0.24;
xgrid(),
xtitle("Modulo em valores absolutos da Função de
    Transferência","Freqüência [Hz]","Módulo em dB");

subplot(3,1,2),
plot2d('ln',f,ym,style=2),
ax=gca();
ax.margins(3:4)=0.24;
xgrid(),
xtitle("Modulo em dB da Função de Transferência","Freqüência
    [Hz]","Módulo em dB");

subplot(3,1,3),
plot2d('ln',f,yf,style=3),
xtitle("Fase da Função de Transferência","Freqüência [Hz]","Fase em
    Graus");
ax=gca();
ax.margins(3:4)=0.24;
xgrid();



Serge Steer
INRIA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110919/d979a328/attachment.htm>


More information about the users mailing list