~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to man/control/frep2tf.cat

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
frep2tf           Scilab Group           Scilab Function            frep2tf
2
 
NAME
3
 
   frep2tf - transfer function realization from frequency response
4
 
  
5
 
CALLING SEQUENCE
6
 
 [h [,err]]=frep2tf(frq,repf,dg [,dom,tols,weight]) 
7
 
PARAMETERS
8
 
 frq        : vector of frequencies in Hz.
9
 
            
10
 
 repf       : vector of frequency response
11
 
            
12
 
 dg         : degree of linear system
13
 
            
14
 
 dom        : time domain ('c' or 'd' or dt)
15
 
            
16
 
 tols       : a vector of size 3 giving the relative and absolute
17
 
            tolerance  and the maximum number of iterations (default values
18
 
            are rtol=1.e-2; atol=1.e-4, N=10).
19
 
            
20
 
 weight     : vector of weights on frequencies 
21
 
            
22
 
 h          : SISO transfer function 
23
 
            
24
 
 err        : error (for example if dom='c' sum(abs(h(2i*pi*frq) -
25
 
            rep)^2)/size(frq,*))
26
 
            
27
 
DESCRIPTION
28
 
   Frequency response to  transfer function conversion. The order of h is a
29
 
  priori given in dg which must be provided. The following linear system is
30
 
  solved in the least square sense.
31
 
  
32
 
  weight(k)*(n( phi_k) - d(phi_k)*rep_k)=0, k=1,..,n
33
 
   where phi_k= 2*%i*%pi*frq when dom='c' and phi_k=exp(2*%i*%pi*dom*frq if
34
 
  not. If the weight vector is not given a default  penalization is used
35
 
  (when dom='c').  A stable and minimum phase system can be obtained by
36
 
  using function factors.
37
 
  
38
 
EXAMPLE
39
 
 s=poly(0,'s');
40
 
 h=syslin('c',(s-1)/(s^3+5*s+20))
41
 
 frq=0:0.05:3;repf=repfreq(h,frq);
42
 
 clean(frep2tf(frq,repf,3))
43
 
 
44
 
 Sys=ssrand(1,1,10); 
45
 
 frq=logspace(-3,2,200);
46
 
 [frq,rep]=repfreq(Sys,frq);  //Frequency response of Sys
47
 
 [Sys2,err]=frep2tf(frq,rep,10);Sys2=clean(Sys2)//Sys2 obtained from freq. resp of Sys
48
 
 [frq,rep2]=repfreq(Sys2,frq); //Frequency response of Sys2
49
 
 xbasc();bode(frq,[rep;rep2])   //Responses of Sys and Sys2
50
 
 [sort(trzeros(Sys)),sort(roots(Sys2('num')))]  //zeros
51
 
 [sort(spec(Sys('A'))),sort(roots(Sys2('den')))] //poles
52
 
 
53
 
 dom=1/1000; // Sampling time 
54
 
 z=poly(0,'z');
55
 
 h=syslin(dom,(z^2+0.5)/(z^3+0.1*z^2-0.5*z+0.08))
56
 
 frq=(0:0.01:0.5)/dom;repf=repfreq(h,frq);
57
 
 [Sys2,err]=frep2tf(frq,repf,3,dom);
58
 
 [frq,rep2]=repfreq(Sys2,frq); //Frequency response of Sys2
59
 
 xbasc();plot2d1("onn",frq',abs([repf;rep2])');
60
 
 
61
 
SEE ALSO
62
 
   imrep2ss, arl2, time_id, armax, frfit   
63