PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Direct Current and Transient Analysis 139


MATLAB Solution
% Script file: charge
I = 1;
T = 2*60;
Q = I*T;
disp(‘*****************************************************’)
disp(‘The charge of 1 amp passing through a point during 2 minutes is :’);
disp(Q);
disp(‘Coulombs’)
format long
Ne=Q*(1/(1.602*10e-19));
disp(‘The number of electrons is:’); disp(Ne)
disp(‘*****************************************************’)

>> charge

***********************************************************************
The charge of 1 amp passing through a point during 2 minutes is :
120 Coulombs
The number of electrons is:
7.490636704119849e+ 019
***********************************************************************

Example 2.2

Create the MATLAB script fi le series that returns the equivalent resistance (across termi-
nals AB) shown in Figure 2.38, where R 1 = 10 Ω, R 2 = 10 Ω, R 3 = 20 Ω, and R 4 = 30 Ω.

MATLAB Solution
% Script file: series
Resist = [10 10 20 30];
Requi = sum(Resist);
disp(‘********************************’)
disp(‘The equivalent resistance is=’); disp(Requi);
disp(‘ Ohms’)
disp(‘********************************’)

>> series

********************************************
The equivalent resistance is =
70 Ohms
********************************************

FIGURE 2.38
Series connections of R 1 , R 2 , R 3 , and R 4 of Example 2.2.

R 1 = 10 Ω R 2 = 10 Ω R 3 = 20 Ω R 4 = 30 Ω
A
B
Free download pdf