PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Direct Current and Transient Analysis 185


grid on;axis([0 3 0 11])
xlabel(‘time t/sec’)
ylabel(‘voltage ‘)
title(‘Voltages across R, for R=1,2 and 5’)
disp(‘The current i(t) through R=1,2 and 5 (in amps) are:’);
disp(‘***************************’);
iR1=10-vctR _ 1
disp(‘***************************’);
iR2=10-vctR _ 2)/2
disp(‘***************************’);
iR5=(10-vctR _ 5)/5
disp(‘***************************’);
figure(3)
ezplot(10-vctR _ 1,[0 4]);hold on;
ezplot(10/2-vctR _ 2/2,[0 4]);hold on;
ezplot(10/5-vctR _ 5/5,[0 4]);hold on;
grid on;axis([0 3 0 11])
xlabel(‘time t/sec’)
ylabel(‘currents’)
title(‘Currents i(t) for:R=1,2 and 5’)

The script fi le RC is executed and the results and plots (Figures 2.86 through 2.88) are
shown as follows:

>> RC
*********************************************************
************* R E S U L T S ****************************
*********************************************************
The voltages across C for R =1,2 and 5 (in volts) are:
*********************************************************
vctR _ 1 =
10-10*exp(-2*t)
*********************************************************
vctR _ 2 =
10-10*exp(-t)
*********************************************************
vctR _ 5 =
10-10*exp(-2/5*t)
*********************************************************
The voltages across R for R=1,2 and 5 (in volts) are:
*********************************************************
vR1 =
10*exp(-2*t)
*********************************************************
vR2 =
10*exp(-t)
*********************************************************
vR5 =
10*exp(-2/5*t)
*********************************************************
The current i(t) through R=1,2 and 5 (in amps) are:
*********************************************************
iR1 =
10*exp(-2*t)
Free download pdf