SUMMARY OF MATLAB

© Dr . Adam S. Kang, Professor, ECE Department, California Poly Pomona Opening MATLAB

Start → Programs → MATLAB → R2010a → MATLAB R2010a

or twice click on icon (

). Slightly different several versions and operating

systems. The MATLAB window leads to as demonstrated below. Depending on Desktop choices, the home window looks diverse. Set the existing Folder on top of the screen.

Working on Control Window

We are demonstrating the use of Command Windows by solving HW Issue 1 . on the lookout for 1 . on the lookout for The size of a 21 AWG water piping (conductivity = σ = 5. 69 × 107 S/m) line is zero. 405mm. Get the level of resistance of the copper mineral wire if the length of the wire is

you

(a) = 20m

(b) = 200m (c) = 2km

(d) = 20km

Enter very clear all; following > > as displayed below.

> > very clear all;

Very clear all clears previously identified variables and commence new. Then simply, type file format compact; > > file format compact;

Structure compact curb extra write off line in the answers. If you would like to restore extra blank collection, type in structure loose. Semicolon indicates the end of an training. If you want to find the answer, tend not to enter semicolon. Enter size, σ, duration as follows: > > d=0. 405e-3; sigma=5. 69e7; l=20;

The radius r is found by dividing the diameter by two:

> > r=d/2

r =

installment payments on your 0250e-004

The cross sectional area of the conductor is given by simply

> > A=pi*r^2

A =

1 . 2882e-007

The resistance has by

> > R=l/(sigma*A)

R sama dengan

2 . 7285

To change the space to 200m, press up arrow (↑) several times to get to the line > > d=0. 405e-3; sigma=5. 69e7; l=20;

Change 20 to two hundred and press Enter:

> > d=0. 405e-3; sigma=5. 69e7; l=200;

Press arrow (↑) several times to get to the line

> > r=d/2

and press Enter in. Repeat this procedure for A and R to get

ur =

installment payments on your 0250e-004

2

> > A=pi*r^2

A =

1 . 2882e-007

> > R=l/(sigma*A)

R =

27. 2846

Repeating the above mentioned procedure, determine resistance ideals for = 2km and = 20km. Rather than using arrows (↑, ↓), it really is easier to change the code by creating MATLAB software. Creating MATLAB Script

Just click File → New →Script. Blank Manager window appears. Type this and preserve the data file:

Run the program by simply clicking Run press button (

effects:

). In the command windowpane, you should begin to see the

r sama dengan

2 . 0250e-004

A sama dengan

1 . 2882e-007

R =

2 . 7285

Change the span to 2 hundred and press Run press button.

3

ur =

2 . 0250e-004

A =

1 . 2882e-007

L =

28. 2846

Repeat for 2km = 2000m and 20km = 20000m.

Creating MATLAB Function

If perhaps n resistors R1, R2, ….., Registered nurse are linked in seite an seite, the equivalent resistance is given by simply Req sama dengan

1

1

1

you

+

+..... +

R1 R2

Registered nurse

We display creation of MATLAB function by writing a function that calculates the equivalent resistance of n resistors R1, R2, ….., Registered nurse connected in parallel. Just click File → New → Function in the Editor or MATLAB window.

4

Replace the template to the following and save. The file S. m ought to be in the Current Folder selected inside the MATLAB home window.

To find the comparative resistance of parallel interconnection of 5kΩ and 20kΩ, in the Order Window, enter

> > P([5 20])

ans =

4

Or, you can type

> > Req=P([5, 20])

Req sama dengan

5

some

EXAMPLE Discover the equivalent level of resistance of the routine shown beneath using MATLAB and verify the answer using direct calculations and PSpice.

R1

R2

9k

5k

R3

15k

R4

36k

R5

45k

R6

50k

R7

75k

R8

45k

Req

MATLAB

> > Req=9+P([15, 36, forty five, 5+P([50, 75, forty five, 90])])

Req =

12-15

The answer is 15kΩ.

Direct Calculations

50k // 75k // 45k // 90k = 15 kΩ, 5k & 15k sama dengan 20kΩ, 15k // 36k // 45k // 20k = 6k. Req = 9k + 6k sama dengan 15kΩ

PSpice

The equivalent resistance is Req = 15V/1mA = 15kΩ.

Y to ∆ and ∆ to Y Transformation

MATLAB capabilities for ∆ to Con and Con to ∆ conversion happen to be shown under. 6

R9

90k

D2Y. m

% Delta to wye conversion

function [Ra Rb Rc]=D2Y(x)

Ra=x(1)*x(3)/sum(x);

Rb=x(1)*x(2)/sum(x);

Rc=x(2)*x(3)/sum(x);

end

Y2D. m

% Wye to delta conversion

function [R1 R2 R3]=Y2D(x)...