You are on page 1of 29

# syms x y t s;

x1 = s*x - (-1);
y1 = s*y - 1;

x(s) = solve(x1==-2*x-1, x)
y(s) = solve(y1==-2*y-1, y)

x(t) = ilaplace(x(s), s, t)
y(t) = ilaplace(y(s), s, t)

Integrator = -1
Integrator1 = 1
syms s;

R = 110000;
C = 1e-6;
tau = R*C;

G(s) = 2*(s*tau)^2/((1+s*tau)*(1+s*2*tau));
pretty(G);
[b,n] = numden(G);
brojnik = sym2poly(b);
nazivnik = sym2poly(n);
G = tf(brojnik, nazivnik);

margin(G);
grid on;
syms s z;
b = [1.5];
a = [1 8 19 12 0];
[r, p, k] = residue(b,a);

r(4)/(s-p(4)));
pretty(G_0);

## G_z0 = ((z^2 - 1)/(z^2))*(-0.125*z/(z-exp(-2)) + 0.25*z/(z-exp(-1.5)) -

0.25*z/(z-exp(-0.5)) + 0.125*z/(z-1));
pretty(G_z0);

[b,n] = numden(G_z0);
brojnik = sym2poly(b);
nazivnik = sym2poly(n);
G_z0tf = tf(brojnik,nazivnik)

G_z = feedback(G_z0tf, 1)

1 +2 ( + 2)(1 )
( )= =
( + 1)( + 0,5) ( + 1)( + 0,5)
+2
= + + | ( + 1)( + 0,5)
( + 1)( + 0,5) +1 + 0,5
+ 2 = ( + 1)( + 0,5) + ( + 0,5) + ( + 1)
+ 2 = ( + + ) + (0,5 + + 0,5 + ) + 0,5

+ + =0
4+ + =0
= 4
= 2 4
= 6
0,5 + + 0,5 + = 1
2 + 4 + 0,5 + = 1
6 + 0,5 4 = 1
0,5 = 1 + 4 6
0,5 = 1
=2

0,5 = 2
=4

+2 4 2 6
= +
( + 1)( + 0,5) +1 + 0,5
4 2 6
( ) = (1 ) +
+1 + 0,5
,
4 2 6
( ) = (1 ) + ,
1
. .
.
4 ( )( ) + 2 ( 1)( ) 6 ( 1)( )
( ) = (1 ) .
( 1)( )( )
. . . ) . )
.
4 ( )(
) + 2 ( 1)( 6 ( 1)(
( ) = (1 ) . )( . )
( 1)(
. )
4 ( 0.607)( 0.779) + 2 ( 1)( 0.779) 6 ( 1)( 0.607)
( ) = (1
( 1)( 0.607)( 0.779)
. )
4 5.544 + 1.891 + 2 3.558 + 1.558 (6 9.642 + 3.642 )
( ) = (1
( 2.386 + 1.859 0.473)
.
0.54 0.193
( ) = (1 )
( 2.386 + 1.859 0.473)
0.54 0.193 0.54 . + 0.193 .
( )=
( 2.386 + 1.859 0.473)
A = 3/4;
fi = 3*pi/2;
w = 3;

t = 0:0.1:10;
x = A*sin(w*t+fi);
plot(x);
axis tight;
grid on;
function x_p = sesti_kolo(t, x)

R = 2.5;
E = 2;
L = 10;
C = 1;

## A = [0 -1/L; 1/C -1/(R*C)];

B = [E/L; E/(R*C)];

x_p = A*x + B;
_______________________________________

t_pk = [0 10]
x_poc_usl = [0 0];
[t, x] = ode45('sesti_kolo', t_pk, x_poc_usl);

subplot(211),plot(t, x(:,1));
title('Struja kroz zavojnicu');
subplot(212),plot(t, x(:,2));
title('Napon na kondenzatoru');
G1 = tf([1],[1 0]);
G2 = tf([1],[1 1]);
G3 = tf([1],[1 2]);
G4 = tf([1],[1 4]);
G5 = tf([1],[2 0]);
A = feedback(G1, 1);
B = G4 - G3;
C = A * G2;
D = 1/G2 + G5;
E = D * B;

Rje = feedback(C, E)
step(Rje);
R = 2e3;
L = 3e-9;
C = 1e-6;

brojnik = [1 0];
nazivnik = [C 1/R 1/L];
G = tf(brojnik, nazivnik)
step(G);
function x_p = dvanaesti_kolo(t, x)

R = 2.5;
L = 10;
C = 1;
E = 2;

## A = [0 -1/L; 1/C -1/(R*C)];

B = [E/L; E/(C*R)];

x_p = A*x + B;
__________________________________

t_pk = [0 10];
x_pu = [0 0];

## [t x] = ode45('dvanaesti_kolo', t_pk, x_pu);

subplot(211),plot(t, x(:,1));
title('Struja na zavojnici');
axis tight;
grid on;
subplot(212),plot(t, x(:,2));
title('Napon na kondenzatoru');
axis tight;
grid on;
function x_p = sesnaesti_kolo(t, x)

R = 2;
L = 2;
C = 1/6;
E = 5;

## A = [0 1/L; -1/C -1/(R*C)];

B = [0; -E/(C*R)];

x_p = A*x + B;

__________________________________________

t_pk = [0 10];
x_pu = [0 0];
[t x] = ode45('sesnaesti_kolo', t_pk, x_pu);

## subplot(211), plot(t, x(:,1));

title('Struja na zavojnici');
axis tight;
grid on;
subplot(212), plot(t, x(:,2));
title('Napon na kondenzatoru');
axis tight;
grid on;
R = 110e3;
C = 1e-6;
t = C*R

A = tf([2], [1])
g1 = tf([t*t 0 0], [1])
g2 = tf([1], [t 1])
g3 = tf([1], [2*t 1])
G = A * g1 * g2 * g3

## bode(A, g1, g2, g3, G);

legend('A', 'g1', 'g2', 'g3', 'G');
syms s t x y;

## [x y] = solve((-s + 2)/(s^4 - s^3 - s^2 + s) + y*(s^2 -s)/(s^2 -1),

x*(s*s^2 - s*s)/(s^2 - 1) + 1/(s^4 - s^2), x, y)

x_t = ilaplace(x)
y_t = ilaplace(y)
RJEENJE
6 + 14
( )=
+2 + 5 +9

= = =
__________________________________

( )= ( ) ( )
( )= ( ) ( )
( )= ( ) ( )
__________________________________

( ) = 6 + 14
1
( )=
+2 + 5 +9

1
( )= ( )
+2 + 5 +9

+2 + 5 +9 =
= 2 5 9 +
= 2 5 9

= = = =
2 5 9 1
= 1 0 0 + 0
0 1 0 0
_______________________________________

( )= ( ) ( )
( ) = (6 + 14) ( )

( ) = 6 + 14

= =

= 0 6 14 + 0

## PROGRAMSKI KOD / SIMULINK MODEL

PODEAVANJE PARAMETARA BLOKOVA
Naziv bloka Podeavanje Vrijednost
Sine Wave 1 Frequency (rad/sec) 3
Transfer Fcn Numerator coefficients [6 14]
Transfer Fcn Denimonator coefficients [1 2 5 9]
Step Step Time 0
State Space A: [-2 -5 -9; 1 0 0; 0 1 0]
State Space B: [1; 0; 0]
State Space C: [0 6 14]
State Space D: 0
Za kolo prikazano na slici odrediti prijenosnu funkciju zatvorenog sistema u z-domenu
(G(z)=Y(z)/X(z)) za period odabiranja T=1 [s].

Kolo zadrke nultog reda (D/A): 1/ * (1 ) = (1 )/s .

## Napomena: Zadatak odrediti analitiki (postupak).

RJEENJE
- Predstavljanje funkcije G0(s) :

1 1 1
( )= = (1 ) = (1 ) + +
( + 1) ( + 1) +1

- Pronalaenje varijabli A, B i C:

1
= + +
( + 1) +1

1 = ( + 1) + ( + 1) +

1= + + + +

1= ( + )+ ( + )+

+ =0 ; = =1
+ =0 ; = = 1
=1
------------------------------------------------------------------------------------------------------------
1 1 1 1
= +
( + 1) +1

1 1 1
( ) = (1 ) +
+1

- Prebacujemo u z domen:

( ) = (1 ) + ; =1
( 1) 1 +

1
( )= +
( 1) 1 +

1 1 1 +2 1
( )= + = +
1 1 + 1 +

( + 2 )( + ) + ( 1) + +2 2 + 2 +1
( )= =
( + )( 1) +

2 +1 0.368 + 0.2642
( )= =
( + 1) + 1.3678 + 0.368
- Predstavljanje funkcije prijenosa u z domenu:

0.368 + 0.2642
( ) 1.3678 + 0.368
( )= =
1 + ( ) 1 + 0.368 + 0.2642
1.3678 + 0.368
0.368 + 0.2642
= 1.3678 + 0.368
1.3678 + 0.368 + 0.368 + 0.2642
1.3678 + 0.368

0.368 + 0.2642
( )=
+ 0.6322
--Analitiki--
+ 3 +2 =5
5
( )+ 3 ( )+ 2 ( )=
+4

( )= ( ) =>

:
( )= ( ) (0) (0) = ( ) +2
( )= ( ) (0) = ( ) 1

5
( ) + 2 + 3( ( ) 1) + 2 ( ) =
+4
5
( ) +2+3 ( ) 3+2 ( ) =
+4
5
( )( + 3 + 2) = + 2+3
+4
5 + + 4 2 8 + 3 + 12
( )( + 3 + 2) =
+4
+5 +9
( )( + 3 + 2) =
+4
+5 +9
( )= +4
+3 +2
+5 +9
( )=
( + 4)( + 3 + 2)

+5 +9
( )=
( + 1)( + 2)( + 4)
+5 +9
( )=
( + 1)( + 2)( + 4)
+5 +9
( )=
( + 1)( + 2)( + 4)

+5 +9
= + +
( + 1)( + 2)( + 4) + +2 +4

## + 5 + 9 = ( + 2)( + 4) + ( + 1)( + 4) + ( + 1)( + 2)

+ 5 + 9 = ( + + ) + (6 + 5 + 3 ) + 8 + 4 + 2

+ + =1 6 +5 +3 =5 8 +4 +2 =9

5 3 5
= = =
3 2 6

( )= + +
5 1 3 1 5 1
( )= +
6 +1 2 +2 6 +4

5 3 5
( )= +
3 2 6

syms s;
y_s = (5/(s+1))/3 - (3/(s+2))/2 + (5/(s+4))/6; %zadana funkcija
pretty(y_s) %naredba za ljepi izgled funkcije
%ilaplace(y_s) %naredba raunanje inverzne Laplasove funkcije
pretty(ilaplace(y_s)) %ljepi izgled inverzne Laplasove funkcije
t=0:0.01:20; %vremenski domen funkcije
y_t = (5*exp(-t))/3 - (3*exp(-2*t))/2 + (5*exp(-4*t))/6; %inverzna
Laplasova funkcija
plot(t,y_t); %iscrtavanje inverzne Laplasove funkcije
xlabel('t');
ylabel('y(t)');
title('Prikaz funkcije y(t) = (5*exp(-t))/3 - (3*exp(-2*t))/2 + (5*exp(-
4*t))/6');

## Naziv bloka Podeavanje Vrijednost

Fcn Expression exp(-4*u)
Gain Gain 5
Gain1 Gain 2
Gain2 Gain 3
Sum List of signs -+-
y'(t) Initial condition 1
y''(t) Initial condition -2
Naziv bloka Podeavanja Vrijednost
int Mat fcn MATLAB function cos(u*3/2)*exp((3/2)*(3/2))-1

M1=1.5 kg

## Naziv bloka Podeavanje Vrijednost

F(t) Constant value 15
1/M Gain 1/1.5
B/M Gain 7/1.5
K/M Gain 2/1.5
t 0:
i L (t ) 0
U C (t ) E
t 0:
dU C (t )
iC (t ) C
dt
1
i R (t ) U C (t )
R
di (t )
U L (t ) L L
dt
U R (t ) R i L (t )

E U R ( t ) U L (t ) U C (t ) 0
di L (t )
E R i L (t ) L U C (t ) 0
dt
di L (t ) R 1 1
iL (t ) U C (t ) E
dt L L L

iL (t ) iR (t ) iC (t ) 0
1 dU C (t )
i L (t ) U C (t ) C 0
R dt
dU C (t ) 1 1
i L (t ) U C (t )
dt C CR

X AX BU
di L (t ) R 1
dt L 1
L i L (t ) E
dU (t ) 1 1 U C (t ) L
C
0
dt C CR
Y CX DU
i (t )
Y 0 1 L 0 E
U C (t )
PROGRAMSKI KOD
E=3;
R=2.1;
L=3;
C_vr=2.1;

A = [-R/L,-1/L; 1/C_vr,-1/(R*C_vr)];
B = [E/L; 0];
C = [0,1];
D = [0];

sistem = ss(A,B,C,D);
step(sistem);

## Naziv bloka Podeavanje Vrijednosti

State Space A [-R/L,-1/L; 1/C_vr, -1/(R*C_vr)]
State Space B [E/L; 0]
State Space C [0 1]
State Space D [0]
Step Step Time 0