31
Universitas Bengkulu Program Studi Teknik Elektro Semester Ganjil 2009 Diberikan tanggal: 3 Sep 09 Tugas 1 Dikumpulkan tanggal: 9 Sep 09 Soal 1: Diagram Blok Gambar 1 Gambar 2 Buatlah diagram blok untuk op-amp yang ditunjukkan pada gambar 1 dan 2. Dengan anggapan bahwa gain op-amp a(s) bernilai konstan dan mendekati tak-hingga, apakah jawaban Anda sesuai dengan harapan? Soal 2: Manipulasi diagram blok Gambar 3 Gambar 4 Sederhanakan diagram blok dalam Gambar 3 menjadi diagram blok dalam Gambar 4. Nyatakan juga F dengan G1, G2 dan H. Soal 3: Sistem koordinat yang berlainan Soal ini akan memperkenalkan beberapa metode untuk menggambar tanggapan frekuensi sebuah sistem. Fungsi alih salah satu contoh sistem tersebut adalah H s = 25.25 s 2 s 25.25 1. gambarkanlah plot nol-nol dan kutub-kutub sistem tersebut! 2. Dengan tangan, gambarlah diagram bode sistem tersebut. Plot magnitude yang diukur dalam dB sebagai log 10 frekuensi dan plot fase linear sebagai fungsi dari log 10 frekuensi . 3. Gambarkan bagian riil dari H j sebagai fungsi dari log 10 frekuensi dan gambarkan juga bagian imajiner H j sebagai fungsi dari log 10 frekuensi . 4. Gambar fungsi alih yang sama dalam koordinat kutub dengan tangan anda. Maksudnya,

Latihan Dasar Sistem Kendali

Embed Size (px)

Citation preview

Page 1: Latihan Dasar Sistem Kendali

Universitas BengkuluProgram Studi Teknik Elektro

Semester Ganjil 2009 Diberikan tanggal: 3 Sep 09Tugas 1 Dikumpulkan tanggal: 9 Sep 09

Soal 1: Diagram Blok

Gambar 1 Gambar 2 Buatlah diagram blok untuk op-amp yang ditunjukkan pada gambar 1 dan 2. Dengan anggapan bahwa gain op-amp a(s) bernilai konstan dan mendekati tak-hingga, apakah jawaban Anda sesuai dengan harapan?

Soal 2: Manipulasi diagram blok

Gambar 3 Gambar 4

Sederhanakan diagram blok dalam Gambar 3 menjadi diagram blok dalam Gambar 4. Nyatakan juga F dengan G1, G2 dan H.

Soal 3: Sistem koordinat yang berlainanSoal ini akan memperkenalkan beberapa metode untuk menggambar tanggapan frekuensi sebuah sistem. Fungsi alih salah satu contoh sistem tersebut adalah

H s= 25.25s2s25.25

1. gambarkanlah plot nol-nol dan kutub-kutub sistem tersebut!2. Dengan tangan, gambarlah diagram bode sistem tersebut. Plot magnitude yang diukur dalam

dB sebagai log10 frekuensi dan plot fase linear sebagai fungsi dari log10 frekuensi .3. Gambarkan bagian riil dari H j sebagai fungsi dari log10 frekuensi dan gambarkan

juga bagian imajiner H j sebagai fungsi dari log10 frekuensi .4. Gambar fungsi alih yang sama dalam koordinat kutub dengan tangan anda. Maksudnya,

Page 2: Latihan Dasar Sistem Kendali

gambarkan magnitud sebagai fungsi dari radius dan sudut fase sebagai fungsi dari fase. Ingatlah bahwa ini adalah plot parametrik. Frekuensi berubah-ubah sepanjang kurva yang anda buat.

5. Gambarkan fungsi alih tersebut dalah koordinat fase dan gain. Grafik jenis ini dibuat berdasarkan pengamatan bahwa magnitud dan sudut fase kedua-duanya adalah fungsi dari frekuensi; Grafik ini menunjukkan log10 magnitude sebagai fungsi langsung sudut fase.

6. Buatlah plot-plot di atas dengan menggunakan SCILAB.

s=poly(0,"s"); // definisi sL=syslin('c',1/((s-1)*(s+3)));// definisi fungsi alihevans(L,2.6); // plot kedudukan akar sistem L//bode(L); // bode plot//t=linspace(0,10,500); // waktu simulasi//stepresp=csim('step',t,L);// tangapan sistem untuk fungsi langkah//impresp=csim('imp',t,L);//plot2d(t,stepresp); // plot tanggapan langkahGambar 6. Contoh script SCILAB untuk menjawab Soal 3.

Soal 4: Kepekaan terhadap perubahan parameterUntuk sistem yang ditunjukan dalam Gambar 5, tentukan besar perubahan gain loop tertutup

sebagai akibat dari perubahan kecil pada nilai a1 , a2 , dan f .

Gambar 5: Sistem yang sensitif

Proyek Komputer 1:Proyek komputer ini harus diselesaikan dengan menggunakan octave, matlab, scilab atau perangkat lunak lain sejenis. Sebaiknya pekerjaan anda disimpan agar dapat digunakan dalam tugas-tugas selanjutnya. Kumpulkan hasil cetak yang label yang jelas.

Tujuan proyek ini adalah mengenalkan anda pada fungsi alih, representasinya serta tanggapanya. Anda akan melihat hubungan antara lokasi kutub-nol dengan tanggapan waktu dan frekuensi yang berhubungan. Untuk fungsi alih-fungsi alih berikut ini buatlah (i) diagram kutub-nol (ii) plot bode (iii) tanggapan langkah ( step response)

a. Sistem orde satu

H 1 s=1

s1b. Untuk sistem orde satu tersebut, kita tambahkan kutub dengan frekuensi yang lebih tinggi.

H 2 s= 2s1 s2

c. Dua fungsi alih berikut ini menambahkan sebuah kutub di bidang paruh-kanan dan satu kutub di bidang paruh-kiri.

Page 3: Latihan Dasar Sistem Kendali

◦ H 3 s=−12

s−2s1

◦ H 4 s=12

s2s1

Page 4: Latihan Dasar Sistem Kendali

Basics of Control Toolbox Home

Scilab memilik banyak perintah=perintah untuk pemanfaatan sistem kendali. Kwbanyakan perintah ini dapat ditemukan dalam berkas-berkas bantuan berikut ini:

• General systems and control (perintah penting syslin ada dalam elementary functions) • Robust control toolbox

kotakperangkat yang terkait adalah:

• Signal processing toolbox • Polynomial calculations

dan selanjutnya tentulah Scicos, sebuah lingkungan grafis untuk membuat simulasi intuitif sistem nyata. Banyak contoh di bawah ini diulah untuk Scicos sebagai perbandingan.

Buku-buku:

• 'Engineering and scientific computing with Scilab', Claude Gomez, editor, ISBN 3-7643-4009-6. Printed 1998, some graphics is of 'the old style' but the other stuff is still valid. Lots of control theory and signal processing. Also a short chapter on Scicos.

• 'Modeling and Simulation in Scilab/Scicos ', Campbell, Chancelier, Nikoukhah, ISBN-13 : 978-0387278025, see http://www.scicos.org

Tutorial Papers

• dalam bahasa Perancis : Quelques exercices d'automatique avec le logiciel Scilab, Lucien Povy . Ini adalah tulisan yang enak dibaca, 93 halaman .pdf. Unduhannya juga memuat sejumlah fungsi=fungsi utilitas yang baik dan didokumentasikan dengan baik. Silahkan unduh dari : http://www.eudil.fr/eudil/lpovy/index.html Perhatikan: berkas tersebut adalah SCI.tar. Ganti ekstensi dari tar menjadi tgz, maksudnya ganti namanya menjadi SCI.tgz. Setelah itu, ia bisa dibuka dengan winzip atau alat sejenis.

• An introduction to Scilab from a Matlab Users Point of View (Sebuah pengenalan SciLab dari sudut pandang pengguna Matlab), karya Eike Rietsch. Memuat banyak table perbandingan antara Matlab dan Scilab dan dapat diunduh dari situs Scilab .

• Dalam bahasa Jerman : Eine Einführung in Scilab, Pincon/Jarausch, direkomendasikan, dapat diunduh dari situs Scilab .

Dalam Scilab, model-model sistem dapat dinyatakan dalam bentuk fungsi atau ruang keadaan dengan perintah berikut:

• poly num, den, tf=num/den -> fungsi alih (continuous or discrete) • abcd ruang keadaan (continuous or discrete)

Kita dapat mengubah bentuk model dengan perintah-perintah berikut ini:

• tf2ss transfer function (fungsi alih) to state-space (ruang keadaan)• ss2tf state space to transfer function • dscr discretization of linear systems • bilin general bilinear transformation • horner variable substitutions, can be used for bilinear transformation

Page 5: Latihan Dasar Sistem Kendali

Kemudian, untuk menjalankan simulasi sebuah sistem, kita dapat menggunakan perintah-perintah berikut ini:

• csim simulasi (tanggapan waktu) sistem linear • dsimul simulasi waktu diskrit ruang keadaan• ltitr tangapan waktu diskrit (rauang keadaan)

Untuk mendapatkan plot-plot kendali biasa, kita dapat menggunakan

• bode Bode plot • nyquist Nyquist plot • evans Evans root locus • black Nichols chart

Berikut ini adalah fungsi-fungsi yang sering digunakan saat bekerja dengan polinomial atau fungsi alih:

• poly • clean • roots • factors • simp_mode

Contoh 1. Ciptakan sebuah sistem sederhana,K

Ts1 dengan K=1 dan T=1 dan plot:

• impulse response (tanggapan impuls)• step response (tanggapan langkah)• ramp response (tanggapan “tanjaka”)• sine response (tanggapan sinus)• Diagram bode untuk frekuensi 0.01-1 Hz

-------------------------------------------------------------------------//kode Scilab, silahkan kopi dari sini ke scipad dan jalankan:

s=%s; // Mula-mula buatlah peubah terlindung//s=poly(0,'s') juga memberikan hasil yang sama (sebagai pilihan lain)

K=1; T=1; // menentukan konstanta perolehan (gain) dan waktu

num=K //numeratorden=T*s+1 // denominatortf=num/den // the transfer polynomial// note that tf is not yet usable, you have to convert it with syslin

// now create a Scilab-usable continuous systemansys=syslin('c',K/(T*s+1))

// create a time axis, linspace(start, end, numberOfSteps)t=linspace(0,10,500);

impresp=csim('imp',t,ansys); // menghitung tanggapan impulse, 'imp' built instepresp=csim('step',t,ansys); // meghitung tanggapan langkah, 'step' built inrampresp=csim(t,t,ansys); // menghitung tangkapan tanjakan, 't' yang anda buat sendiri

Page 6: Latihan Dasar Sistem Kendali

y=sin(2*%pi*1*t); // membuat funsi sinussinresp=csim(y,t,ansys); // menggunakannya untuk mendapat tanggapan sinus

//Sekarang membuat plot; gunakan subplot untuk tanggapan waktu yang telah dihitung

xset('window',1); xbasc(); // Membuat jendela untuk subplot

subplot(4,1,1); plot2d(t,impresp); xgrid();subplot(4,1,2); plot2d(t,stepresp); xgrid();// Kami membuat plot t dan tanggapan tanjakan sebagai perbandingansubplot(4,1,3); plot2d(t,t); plot2d(t,rampresp,style=5);xgrid();// Kami membuat plot sinus dan tanggapan sinus untuk perbandingansubplot(4,1,4);plot2d(t,y); plot2d(t,sinresp,style=5); xgrid();

xset('window',2); xbasc(); // Membuat jendela baru untuk diagram bodebode(ansys,0.01,1); //menghitung dan memplot diagrram bode

// Bacalah help syslin, csim, bode,// kopi sampai di sini-------------------------------------------------------------------------Hasilnya dapat dilihat di bawah ini:

num =1. den =1 + s

1 tf = ---- 1+s 1ansys= ----- 1 + s

window 1, subplots 1-4 , the time plots from the program above

Page 7: Latihan Dasar Sistem Kendali

window 2, the bode plot from the program above

Page 8: Latihan Dasar Sistem Kendali

Contoh 2

Buatlah fungsi alih tf = s1 s23s2

Contoh ini mengilustrasikan perintah-perintah poly, simp_mode dan roots.

Perhatikan

• Mode penyederhanaan• tiga cara utama membuat polinomial: ekspresi langsung, poly dengan akar-akar dan poly

dengan polinomial.

----------------------------------------------------// Kode Scilab, mulai kopi dari sini// Contoh kendali 2, demo penggunaan simp_mode

s=%s; // Pertama, buatlah peubah yang terproteksi. First create a protected variable//s=poly(0,'s') akan menghasilkan hasil yang sama produces the same (as an alternative)

num=s+1; //Penyebut fungsi alih // numerator of transfer functionden=s^2+3*s+2; // Pembilang fungsi alih // denominator of transfer functiontf=num/den // Polinomial fungsi alih // the transfer polynomial// hasilnya adalah 1/(2+s), mungkin bukan yang ada inginkan// Scilab memiliki kemampuan perhitungan simbolic dan menyederhanakan persamaan

simp_mode(%f); //menonaktifkan moda penyederhanaantf1=num/den // sekarang suku-suku yang ada tidak disederhanakan// Sekarang hasilnya adalah tf1 = (1+s)/(2+3*s+s^2)simp_mode(%t); // mengaktifkan kembali moda penyederhanaan

// diperlukan atau tidaknya penyederhanaan tergantung dengan tipe masalahnya

// mengambil akar-akar pembilang //we extract the roots of den:rots=roots(den) // dan mendapatkan akar-akar tersebut adalah // rots =// -1.// -2.//Perhatikan, akar-akar tersebut disimpan dalam sebuah vektor kolom. Jadi den = (s+1)*(1+2)(1+s)*(2+s) // = 2+3*s+s^2// so Scilab canceled the factors (s+1)

// you can define a polynomial by its roots (this is the default):tfroots=poly([-1, -2],'s') // result: 2 +3*s +s^2 // ortfroots1=poly(rots', 's') // the same, note that rots is transposed// or with the polynomial coefficients, then you have to set the flag 'coeff' or 'c'tfcoeff=poly([2,3,1],'s','coeff') // result: 2 +3*s +s^2

// poly, simp_mode, roots// copy to here and paste and run in scipad----------------------------------------------------Note that Scilab has significant symbolic capabilities with polynomials. Refer to the literature above

Page 9: Latihan Dasar Sistem Kendali

Sistem-sitem ruang keadaan Anggaplah bahwa sebuah sistem linear dinamis dijelaskan oleh sebuah fungsi alih, misalnya:

Ini menjelaskan hubungan antara luaran y dan masukan u.

If you also want to look at the 'internals' of the system you can convert the system to its state space form by using the Scilab command tf2ss (transfer function to state space). This is not a unique procedure. Matlab has exactly the same command but it gives another result when used directly.Therefore it may be useful to first illustrate several ways to get the state space for the function above by using only 'paper and pencil', compare them and then simulate the various form in Scicos. We have used state variables before (without saying it explicitly) in tutorial Scilab example 1 above). This is a very basic text intended to be helpful to the books mentioned above. It is also intended to show the usefulness of Scicos.

State space system in phase variable form.

The transfer function at hand is:

The corresponding differential equation is :

This means at first sight, that given the input u, u has to be differentiated. That is a bad thing to do and it can be avoided by using state variables.The trick is simply to separate the numerator from the denominator and introduce an intermediate variable x1 :

The denominator describes the system dynamics and we start with the function x1/u:

The corresponding differential equation with the highest derivative on the left side is :

The equation is of second order and a convenient way to select state variables is to take the outputs of the two integrators needed.

If we use the state space variables x1 and x2 to describe the equation from above:

one gets:

Page 10: Latihan Dasar Sistem Kendali

The complete denominator can now be drawn as below:

Now we chain the numerator to the system:

The added box s+3 means: take the derivative of x1 (which is x2) and add 3 times x1.

So the denominator completely describes the state of the system, its dynamics. The numerator simply collects state variables (derivatives and variables that are already formed by the denominator) and produces the desired output y. This way, direct differentiation of the input is avoided.

Page 11: Latihan Dasar Sistem Kendali

Now we have the following set of equations:

and in matrix form:

• A is the system matrix • B is the input matrix • C is the output matrix

At rare occasions we may have a direct link between input and output, for example when the numerator has the same order as the denominator. In that case the output equation y = C x is modified to y = Cx + Du where D is a direct matrix..

Below is a Scicos simulation (download the zipped .cos-file statePhase.zip)The diagram contains three possibilities to simulate the same thing.

• The original transfer function, numerator is inserted as 3+s, denominator as 24 + 10*s + s^2 • A Scicos block that permits writing the state matrices directly, they are inserted as:

A [0 1 ; -24 -10]B [ 0 ; 1]C [ 3 1]D [0]

• and at the bottom the system made from basic blocks.

The other settings can be seen from the downloaded file.The three results are wired into a Mscope and plotted, they give of course the same graphs

Page 12: Latihan Dasar Sistem Kendali

Resulting graphs from the Mscope, all graphs show y vs time in sec,

• the first graph from the transfer function block • the second graph from the state space block • the third graph from the state space system built by elementary blocks

and they are the same of course.

Page 13: Latihan Dasar Sistem Kendali

The canonical controller form

The previous transfer function can be given in the 'canonical controller' form by simply renumbering the state variables above in the phase variable form. In this case x1(phase)->x2(controller form) and x2(phase)-> x1(controller form). Otherwise the diagram has exactly the same structure.

The equations are:

and in matrix form:

Here is the Scicos diagram (download stateContr.zip). The only difference is in the state space block that has the reshuffled inputs:A = [-10 -24;1 0], B = [1;0], C = [1 3]

Page 14: Latihan Dasar Sistem Kendali

and the results, same as above:

Note: this is what Matlab tf2ss gives you if you do not use any flags etc.

The canonical observer formSame example as before :

Page 15: Latihan Dasar Sistem Kendali

Divide each term in the numerator and the denominator by the highest power of s, s^2:

Rewrite the equations :

and to its final form:

Now the diagram can be drawn :

The state space equations are (compare diagram):

and in matrix form:

The Scicos diagram (download stateObs.zip) shows three versions of the same thing:

Page 16: Latihan Dasar Sistem Kendali

• the transfer function • the state space system simulated with the state space block • the state space system simulated with basic building blocks

The results are the same as for the examples above:

Page 17: Latihan Dasar Sistem Kendali

The parallel form (diagonal form)If the transfer function denominator has no repeated roots, the parallel form can be obtained by a partial fraction expansion of the transfer function.The denominator of the same example as before:

has roots -4 and -6 and can be written in partial fractions as:

You can achieve this with Scilab using the command 'roots' and 'pfss' .Here is a piece of code that does that:-------------------------------------------------s=%s; // declare s protected variablenum=(s+3);den=(s^2+10*s+24);tf=num/den; // create transfer function from num and denroots(den) // see if you have nonrepeated roots, not necessary here// pfss makes a partial fractions expansion,// the two fractions are given in fractions(1) and fractions(2)fractions=pfss(tf)// verify that you have what you started with:expr=fractions(1)+fractions(2)//end of Scilab code

Result:--> ans = - 4. - 6. fractions =

fractions(1) 1.5 ----- 6 + s

fractions(2) - 0.5 ----- 4 + s

expr = 3 + s ----------- 24 +10s + s^2 ---------------------------------

We assign the output of each fraction a state variable, for example like this :

Page 18: Latihan Dasar Sistem Kendali

Here is a Scicos simulation, state space block settings: A=[-6 0 ; 0 -4], B=[1.5 ; 0.5], C=[1 -1], (download stateParal.zip):

The familiar results :

Page 19: Latihan Dasar Sistem Kendali

for linear systems with non-repeating roots the A-matrix will always be a diagonal matrix, therefore this form is often called the diagonal form.

The serial form

If one factors the example transfer function (use for example 'roots' as above) one gets:

with the diagram:

The same diagram with basic components:

The state equations are (note the creation of the output y):

Page 20: Latihan Dasar Sistem Kendali

In matrix form these equations become:

Scicos simulation of the serial form (download stateSerial.zip here)

The results check out well.

Page 21: Latihan Dasar Sistem Kendali

To go the other way, creating a transfer function from the various forms, you can use command ss2tfBelow this is done for the forms above. The results demonstrate that:

• creating a state space system from a transfer function is NOT a unique procedure, many forms are possible depending on state variable selection etc. as shown above.

• going back from state space to transfer function is a unique procedure. You always get the same transfer function from various forms of the same system., this is demonstrated below:

Scilab code, just copy and paste into Scipad Results from Scilab codes=%s; // create symbolic variable

//Phase variable formA=[0 1 ; -24 -10];B=[0;1];C=[3 1];D=0; x0=[0;0];// make a system list:sl=syslin('c',A,B,C,D,x0);//convert to transfer function:tfphase=ss2tf(sl)

//Controller form:A=[-10 -24 ; 1 0];B=[1;0];C=[1 3];D=0; x0=[0;0];// make a system list:sl=syslin('c',A,B,C,D,x0);//convert to transfer function:tfcontr=ss2tf(sl)

Results are all the same:

--> tfphase = 3 + s ----------- 2 24 + 10s + s tfcontr = 3 + s ----------- 2 24 + 10s + s tfobs = 3 + s ----------- 2 24 + 10s + s

Page 22: Latihan Dasar Sistem Kendali

// Observer form:A=[-10 1 ; -24 0];B=[1;3];C=[1 0];D=0; x0=[0;0];// make a system list:sl=syslin('c',A,B,C,D,x0);//convert to transfer function:tfobs=ss2tf(sl)

// Parallel form:A=[-6 0 ; 0 -4];B=[1.5 ; 0.5];C=[1 -1];D=0; x0=[0;0];// make a system list:sl=syslin('c',A,B,C,D,x0);//convert to transfer function:tfparallel=ss2tf(sl)

// Serial form:A=[-6 1 ; 0 -4];B=[0 ; 1];C=[-3 1];D=0; x0=[0;0];// make a system list:sl=syslin('c',A,B,C,D,x0);//convert to transfer function:tfserial=ss2tf(sl)//***************************************//The above all give exactly the same transfer function://// 3 + s// -----------// 2// 24 + 10s + s //***************************************

tfparallel = 3 + s ----------- 2 24 + 10s + s tfserial = 3 + s ----------- 2 24 + 10s + s

So what does Scilab do when tf2ss is applied to a transfer function?First some code for our example:

Scilab code, just copy and paste into Scipad Results from Scilab code// define Laplace variables=%s;

// define transfer functionnum=3+s;den=24+10*s+s^2;// make a linear system:

Results:

output from command syslin--> sys_tf = 3 + s ----------- 2

Page 23: Latihan Dasar Sistem Kendali

sys_tf=syslin('c',num/den)

// transform to state spacesys_ss=tf2ss(sys_tf);

// the command abcd retrieves the matrixes:[A,B,C,D]=abcd(sys_ss)

// command ssprint prints 'pretty print' versionssprint(sys_ss)

// Now we go back to the transfer function (note x0 assumed []:

sys_tf1=ss2tf(sys_ss)

24 + 10s + s

Output from abcd: D = 0.

C = - 0.5220153 1.110D-16 B = - 1.9156526 0.5746958 A = - 7.0825688 - 0.2752294 12.124771 - 2.9174312

Output from ssprint, note the dot over x:

. |-7.0825688 -0.2752294 | |-1.9156526 |x = | 12.124771 -2.9174312 |x + | 0.5746958 |u

y = |-0.5220153 0 |x

Now we go back to the transfer function (note that D and x0 assumed []):

Output from ss2tf, result:

--> sys_tf =

3 + s ----------- 2 24 + 10s + s

Below is a Scicos simulation of the system created directly with Scilab (Download and run stateScil.zip) :

Page 24: Latihan Dasar Sistem Kendali

The results the same as before:

Page 25: Latihan Dasar Sistem Kendali

As one can see, Scilab does not give an easy recognizable form of the state equation, nor is it possible to easily convert it to a 'familiar' form. Scilab tries to make a similarity transform on the A- matrix such that the column norms and row norms are nearly equal. The result is similar to a balanced form that improves the accuracy of calculating eigenvalues. If one computes the condition numbers for the Scilab form of the simple examples above, they are not much better than the condition numbers computed directly for the simple forms above, however, the algorithms are made for large systems with multiple inputs and outputs. Then the 'familiar' forms tend to become ill-conditioned and optimizing and scaling the matrices may help to avoid numerical troubles. On the other hand, the condition numbers may become better with the Scilab form but one drawback is that the system matrices get much more complicated and the resulting equations often take a much longer time to simulate, see for example the mimo-example.

• State space models may seem complicated at first sight, and indeed they are for simple systems, but they are often a natural way to express systems and their internals.

• State space models are very suitable for multiple input-output systems. If such systems are to be described with transfer functions, one would need one transfer function from each input (or disturbance) to every output.. A process with 3 inputs and 4 outputs would need 12 transfer functions. In a state space model, only the size of the matrices are increased.

• Nonlinearities are easier to handle in state space models

On the other hand:

• For simple systems state space models are more complicated than transfer functions. • Since well-conditioned state space systems can get complicated, the resulting equations can

take a longer time to solve (simulate) numerically. • It is more difficult to handle delays with state space models.

Page 26: Latihan Dasar Sistem Kendali

Figure shows general block diagram of a linear state space system.Grey lines can be vectors.

For the matrices :

• x = columnvector n (n state variables) • u = columnvector m ( m inputs) • y = columnvector k (k outputs)

• The A matrix is a square matrix with dimension n, A -> n x n • The number of columns in the B matrix equals the number of inputs (intentional inputs and

disturbances) B -> n x m • The number of rows in the C- and D-matrix equals the number of output signals. C -> k x n

D -> k x m • For most physical systems, the numerator has a lower degree than the denominator, such

systems are often called 'strictly proper' systems. • The A and B matrices determine the dynamics of the system. • The C matrix determines the static relation between the state variables and the output. • The D matrix determines the static direct connection (if any) between input and output. • The system poles are determined by the A matrix only. • The following relation exists between the controller form and the observer form, if either has

matrices A, B and C, the other has matrices A1, B1 and C1 where:A1 = transpose(A); B1 = transpose(C); C1 = transpose(B), check examples above with Scilab:// controller form :A=[-10 -24; 1 0];B=[1;0];C=[1 3];// relation to observer form:A1=A'B1=C'C1=B'

//Results observer form:// A1 =// - 10. 1.// - 24. 0.//// B1 =// 1.// 3.//// C1 =

Page 27: Latihan Dasar Sistem Kendali

// 1. 0. Commands used so far:tf2ss transfer function to state spaceroots finds roots of polynomialspfss converts a transfer function to partial fractionsss2tf state space to transfer functionsyslin makes a system list of polynomial quotients (or state space matrices)abcd returns the state space matricesssprint 'pretty print' of state space matrices

Multiple input-multiple output (MIMO) example to demonstrate Scilab and Scicos

Page 28: Latihan Dasar Sistem Kendali

Scilab Function

Last update : 28/06/2004

bode - Bode plot

Calling Sequence

bode(sl,[fmin,fmax] [,step] [,comments] ) bode(sl,frq [,comments] ) bode(frq,db,phi [,comments]) bode(frq, repf [,comments])

Parameters

sl : syslin list (SISO or SIMO linear system) in continuous or discrete time. fmin,fmax : real (frequency bounds (in Hz)) step : real (logarithmic step.) comments : vector of character strings (captions). frq : row vector or matrix (frequencies (in Hz) ) (one row for each SISO subsystem). db : row vector or matrix ( magnitudes (in Db)). (one row for each SISO subsystem). phi : row vector or matrix ( phases (in degree)) (one row for each SISO subsystem). repf : row vector or matrix of complex numbers (complex frequency response).

Description

Bode plot, i.e magnitude and phase of the frequency response of sl .

sl can be a continuous-time or discrete-time SIMO system (see syslin ). In case of multi-output the outputs are plotted with different symbols.

The frequencies are given by the bounds fmin,fmax (in Hz) or by a row-vector (or a matrix for multi-output) frq .

step is the ( logarithmic ) discretization step. (see calfrq for the choice of default value).

comments is a vector of character strings (captions).

db,phi are the matrices of modulus (in Db) and phases (in degrees). (One row for each response).

repf matrix of complex numbers. One row for each response.

Default values for fmin and fmax are 1.d-3 , 1.d+3 if sl is continuous-time or 1.d-3 , 0.5 if sl is discrete-time. Automatic discretization of frequencies is made by calfrq .

Examples

s=poly(0,'s')h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))title='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';bode(h,0.01,100,title);

Page 29: Latihan Dasar Sistem Kendali

h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))clf()bode([h1;h],0.01,100,['h1';'h'])

See Also

polarplot - Plot polar coordinates

Calling Sequence

polarplot(theta,rho,[style,strf,leg,rect]) polarplot(theta,rho,<opt_args>)

Parameters

rho : a vector, the radius values theta : a vector with same size than rho, the angle values. <opt_args> : a sequence of statements key1=value1, key2=value2 , ... where keys may be style , leg , rect , strf or frameflag style : is a real row vector of size nc. The style to use for curve i is defined by style(i) . The default style is 1:nc (1 for the first curve, 2 for the second, etc.). - if style(i) is negative, the curve is plotted using the mark with id abs(style(i))+1 ; use xset() to see the mark ids. - if style(i) is strictly positive, a plain line with color id style(i) or a dashed line with dash id style(i) is used; use xset() to see the color ids. - When only one curve is drawn, style can be the row vector of size 2 [sty,pos] where sty is used to specify the style and pos is an integer ranging from 1 to 6 which specifies a position to use for the caption. This can be useful when a user wants to draw multiple curves on a plot by calling the function plot2d several times and wants to give a caption for each curve. strf : is a string of length 3 "xy0" . default The default is "030" . x : controls the display of captions, x=0 : no captions. x=1 : captions are displayed. They are given by the optional argument leg . y : controls the computation of the frame. same as frameflag y=0 : the current boundaries (set by a previous call to another high level plotting function) are used. Useful when superposing multiple plots. y=1 : the optional argument rect is used to specify the boundaries of the plot. y=2 : the boundaries of the plot are computed using min and max values of x and y . y=3 : like y=1 but produces isoview scaling. y=4 : like y=2 but produces isoview scaling. y=5 : like y=1 but plot2d can change the boundaries of the plot and the ticks of the axes to produce pretty graduations. When the zoom button is activated, this mode is used. y=6 : like y=2 but plot2d can change the boundaries of the plot and the ticks of the axes to produce pretty graduations. When the zoom button is activated, this mode is used. y=7 : like y=5 but the scale of the new plot is merged with the current scale. y=8 : like y=6 but the scale of the new plot is merged with the current scale.

leg : a string. It is used when the first character x of argument strf is 1. leg has the form "leg1@leg2@...." where leg1 , leg2 , etc. are respectively the captions of the first curve, of the

Page 30: Latihan Dasar Sistem Kendali

second curve, etc. The default is "" . rect : This argument is used when the second character y of argument strf is 1, 3 or 5. It is a row vector of size 4 and gives the dimension of the frame: rect=[xmin,ymin,xmax,ymax] .

Description

polarplot creates a polar coordinate plot of the angle theta versus the radius rho. theta is the angle from the x-axis to the radius vector specified in radians; rho is the length of the radius vector specified in dataspace units.

Examples

t= 0:.01:2*%pi;clf();polarplot(sin(7*t),cos(8*t))

clf();polarplot([sin(7*t') sin(6*t')],[cos(8*t') cos(8*t')],[1,2])

Page 31: Latihan Dasar Sistem Kendali