Sie sind auf Seite 1von 7

1.

Response of an RC circuit
a. Koding
t = 0:0.5:4;
y = 6*exp(-2*t);
plot(t, y);
title('Response of an RC circuit');
xlabel('time in seconds');
ylabel('voltage in volts');
grid on;

b. Pengujian

2. Voltage and Current of an RL circuit


a. Koding
%RL circuit
%current i(t) and voltage v(t) are generated; t is time
t = 0:1E-3:20E-3;
v = 10*cos(377*t);
a_rad = (60*pi/180);
% angle in radians
i = 5*cos(377*t + a_rad);
plot(t,v,'*',t,i,'o');
title('Voltage and Current of an RL circuit');
xlabel('Sec');
ylabel('Voltage(V) and Current(mA)');
text(0.003, 1.5, 'v(t)');
text(0.009,2, 'i(t)');
b. Pengujian

3. Bode plot of an amplifier


a. Koding
% Bode plot for capacitively coupled amplifier
f = [20 40 80 100 120 2000 5000 8000 10000 ...
12000 15000 20000];
g = [ 5 10 30 32 34 34 34 34 32 30 10 5];
semilogx(f,g);
title('Bode plot of an amplifier');
xlabel('Frequency in Hz');
ylabel('Gain in dB');
grid on;

b. Pegujian
4. Current of an RL circuit
a. Koding
% tau1 is time constant when switch is at b
% tau2 is the time constant when the switch is in position c
tau1 = 200/100;
for k=1:20
t(k) = k/20;
i(k) = 0.4*(1-exp(-t(k)/tau1));
end
imax = i(20);
tau2 = 200/200;
for k = 21:120
t(k) = k/20;
i(k) = imax*exp(-t(k-20)/tau2);
end
% plot the current
plot(t,i,'o');
axis([0 6 0 0.18]);
title('Current of an RL circuit');
xlabel('Time, s');
ylabel('Current, A');
grid on;

b. Pengujian
5. Magnitude Response
a. Koding
num = [2 0 4];
den = [1 4 16];
w = logspace(-2, 4);
h = freqs(num, den, w);
f = w/(2*pi);
mag = 20*log10(abs(h));
semilogx(f, mag)
title('Magnitude Response')
xlabel('Frequency, Hz')
ylabel('Gain, dB')
grid on;

b. Pengujian

6. Lowpass Filter Response


a. Koding
num = [2];
den = [1.05e-4 1];
w = logspace(1,5);
h = freqs(num,den,w);
f = w/(2*pi);
mag = 20*log10(abs(h));
% magnitude in dB
semilogx(f,mag)
title('Lowpass Filter Response')
xlabel('Frequency, Hz')
ylabel('Gain in dB')
b. Pengujian

7. Graphical method - operating point


a. Koding
% diode equation
k = 1.38e-23;q = 1.6e-19;
t1 = 273 + 25; vt = k*t1/q;
v1 = 0.25:0.05:1.1;
i1 = 1.0e-12*exp(v1/(2.0*vt));
% load line 10=(1.0e4)i2 + v2
vdc = 10;
r = 1.0e4;
v2 = 0:2:10;
i2 = (vdc - v2)/r;
% plot
plot(v1,i1,'k', v2,i2,'k')
axis([0,2, 0, 0.0015])
title('Graphical method - operating point')
xlabel('Voltage (V)')
ylabel('Current (A)')
text(0.4,1.05e-3,'Loadline')
text(1.08,0.3e-3,'Diode curve')

b. Pengujian
8. Hole concentration
a. Koding
% hole concentration in a n-type semiconductor
nd = logspace(13,18);
n = nd;
ni = 1.52e10;
ni_sq = ni*ni;
p = ni_sq./nd;
semilogx(nd,p,'b')
title('Hole concentration')
xlabel('Doping concentration, cm-3')
ylabel('Hole concentration, cm-3')

b. Pengujian

Das könnte Ihnen auch gefallen