1
<?xml version="1.0" encoding="UTF-8"?>
3
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4
* Copyright (C) INRIA -
6
* This file must be used under the terms of the CeCILL.
7
* This source file is licensed as described in the file COPYING, which
8
* you should have received as part of this distribution. The terms
9
* are also available at
10
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13
<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" version="5.0-subset Scilab" xml:lang="en" xml:id="frep2tf">
15
<refname>frep2tf</refname>
16
<refpurpose> transfer function realization from frequency response</refpurpose>
19
<title>Calling Sequence</title>
20
<synopsis>[h [,err]]=frep2tf(frq,repf,dg [,dom,tols,weight])</synopsis>
23
<title>Arguments</title>
28
<para>vector of frequencies in Hz.</para>
34
<para>vector of frequency response</para>
40
<para>degree of linear system</para>
47
time domain (<literal>'c'</literal> or <literal>'d'</literal> or <literal>dt</literal>)
55
a vector of size 3 giving the relative and absolute tolerance and the maximum number of iterations (default values are <literal>rtol=1.e-2; atol=1.e-4, N=10</literal>).
62
<para>vector of weights on frequencies</para>
68
<para>SISO transfer function</para>
75
error (for example if <literal>dom='c'</literal> <literal>sum(abs(h(2i*pi*frq) - rep)^2)/size(frq,*)</literal>)
82
<title>Description</title>
84
Frequency response to transfer function conversion. The order of <literal>h</literal>
85
is a priori given in <literal>dg</literal> which must be provided.
86
The following linear system is solved in the least square sense.
88
<programlisting role=""><![CDATA[
89
weight(k)*(n( phi_k) - d(phi_k)*rep_k)=0, k=1,..,n
92
where <literal>phi_k= 2*%i*%pi*frq</literal> when <literal>dom='c'</literal> and <literal>phi_k=exp(2*%i*%pi*dom*frq</literal> if not. If the <literal>weight</literal> vector is not given a default
93
penalization is used (when <literal>dom='c'</literal>).
96
A stable and minimum phase system can be obtained by using function <literal>factors</literal>.
100
<title>Examples</title>
101
<programlisting role="example"><![CDATA[
103
h=syslin('c',(s-1)/(s^3+5*s+20))
104
frq=0:0.05:3;repf=repfreq(h,frq);
105
clean(frep2tf(frq,repf,3))
108
frq=logspace(-3,2,200);
109
[frq,rep]=repfreq(Sys,frq); //Frequency response of Sys
110
[Sys2,err]=frep2tf(frq,rep,10);Sys2=clean(Sys2)//Sys2 obtained from freq. resp of Sys
111
[frq,rep2]=repfreq(Sys2,frq); //Frequency response of Sys2
112
clf();bode(frq,[rep;rep2]) //Responses of Sys and Sys2
113
[gsort(spec(Sys('A'))),gsort(roots(Sys2('den')))] //poles
116
dom=1/1000; // Sampling time
118
h=syslin(dom,(z^2+0.5)/(z^3+0.1*z^2-0.5*z+0.08))
119
frq=(0:0.01:0.5)/dom;repf=repfreq(h,frq);
120
[Sys2,err]=frep2tf(frq,repf,3,dom);
121
[frq,rep2]=repfreq(Sys2,frq); //Frequency response of Sys2
122
clf();plot2d1("onn",frq',abs([repf;rep2])');
125
<refsection role="see also">
126
<title>See Also</title>
127
<simplelist type="inline">
129
<link linkend="imrep2ss">imrep2ss</link>
132
<link linkend="arl2">arl2</link>
135
<link linkend="time_id">time_id</link>
138
<link linkend="armax">armax</link>
141
<link linkend="frfit">frfit</link>