-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.m
58 lines (45 loc) · 1.16 KB
/
test.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%%
R1 = 20 * 10^3;
R2 = 3.84 * 10^3;
RE = 220;
RC = 1.2 * 10^3;
RL = 45;
C1 = 10^(-6);
C2 = 10^(-9);
CE = 10^(-6);
Rb = 1 * 10^3;
r_pi = 1.2 * 10^3;
beta = 169;
ib = 28 * 10^(-6);
[Vi, Vo, A] = small_signal_model(w, R1, R2, RE, RC, RL, C1, C2, CE, Rb, r_pi, beta, ib);
frq_lst = [100, 300, 10^3, 2*10^3, 5*10^3, 10*10^3];
for f = 1:length(frq_lst)
frq = frq_lst(f);
[frq_scaled, ~, ~, label] = scientific_rescale(frq);
disp([newline, 'Frequency = ', num2str(frq_scaled), ' ', label, 'Hz']);
disp(['Vi = ' num2str(double(Vi(frq)))])
disp(['Vo = ' num2str(double(Vo(frq)))])
disp(['A = ' num2str(double(A(frq)))])
end
function [Vi, Vo, A] = small_signal_model(w, R1, R2, RE, RC, RL, C1, C2, CE, Rb, r_pi, beta, ib)
syms w
ic = beta * ib;
ZC1 = 1/(1j * w * C1);
ZC2 = 1/(1j * w * C2);
ZCE = 1/(1j * w * CE);
Zi = Z_parallel([ZC1, R1, R2]) + Rb;
Ze = Z_parallel([ZCE, RE]);
Zo = Z_parallel([ZC2 + RL, RC]);
Vi = ib * (Zi + r_pi) - (ib + ic) * Ze;
Vo = ic * Zo;
A = Vo / Vi;
Vi = matlabFunction(Vi);
Vo = matlabFunction(Vo);
A = matlabFunction(A);
end
function Zeq = Z_parallel(z)
Zeq = 1/sum(1./z);
end
function Zeq = Z_series(z)
Zeq = sum(z);
end