4 Create the following matrices with MATLAB and use them in

4. Create the following matrices (with MATLAB), and use them in the exercises that follow:

a. Create a row vector called d from the second column of matrix a.

b. Combine vector b and the transpose of vector d to create matrix e, a two-dimensional matrix with three rows and two columns.

c. Combine vector b and vector d to create matrix f, a one-dimensional matrix with six rows and one column.

d. Create a matrix g, with four rows and three columns, from matrix a and the first three elements of matrix c.

e. Create a column vector h with the first element equal to a1,3, the second element equal to c1,2, and the third element equal to b2,1.

5. The action of sun sunlight on green plants powers a process called photosynthesis, in which plants capture energy from light and store energy in chemical form. During photosynthesis, x1 moles of carbon dioxide (CO2) and x2 moles of water (H2O) are converted into x3 moles of oxygen (O2) and x4 moles of complex carbohydrates, such as glucose (C6H12O6). Find the smallest positive integer solution that balances the chemical equation (with or without MATLAB)

x1 CO2 + x2 H2O ? x3 O2 + x4 C6H12O6

5 3 22 3 8 5 14 3 82

Solution

We want to create the following matrices (with MATLAB), and use them in the exercises that follow:

function createD()

A=[15 3 22;3 8 5;14 3 82]

for i=1:3

    D(i)=A(i,3);

end

D=D\';

D

End

Output:


>> createD()

A =

    15     3    22

     3     8     5

    14     3    82

D =

    22

     5

    82

b)

function createE()

B=[1; 5; 6]

D=[22; 5; 82]

E=[B D]

End

Output:


>>createE()

B =

     1

     5

     6

D =

    22

     5

    82

E =

     1    22

     5     5

     6    82

c)

function createF()

B=[1; 5; 6]

D=[22; 5; 82]

F=[B; D]

end

Output:

>>createF()

B =

     1

     5

     6

D =

    22

     5

    82

F =

     1

     5

     6

    22

     5

    82

d)

function createG()

A=[15 3 22;3 8 5;14 3 82]

for i=1:3

    D(i)=A(i,1);

end

D=D\';

for i=1:3

    E(i)=A(i,3);

end

E=E\';

B=[1; 5; 6]

C=[12 18 5];

C=C\';

C

G=[D E C]

end

Output:

>>createG()

A =

    15     3    22

    3     8     5

    14     3    82

B =

     1

     5

     6

C =

    12

    18

     5

G =

    15    22    12

     3     5    18

    14    82     5

e)

function createH()

A=[15 3 22;3 8 5;14 3 82]

for i=1:3

    D(i)=A(2,i);

end

D

C=[12 18 5];

for i=1:3

    E(i)=A(3,i);

end

E

B=[1; 5; 6];

B=B\';

B

H=[D; C; E; B]

end

Output:

>>createH()

A =

    15     3    22

     3     8     5

    14     3    82

D =

     3     8     5

E =

    14     3    82

B =

     1     5     6

H =

     3     8    5

    12    18     5

    14     3    82

     1     5     6

f)

function createK()

A=[15 3 22;3 8 5;14 3 82]

K=[A(1,1) A(1,3); A(3,1) A(3,3)]

end

Output:

>> createK()

A =

    15     3    22

     3     8     5

    14     3    82

K =

    15    22

    14    82

4. Create the following matrices (with MATLAB), and use them in the exercises that follow: a. Create a row vector called d from the second column of matrix a. b
4. Create the following matrices (with MATLAB), and use them in the exercises that follow: a. Create a row vector called d from the second column of matrix a. b
4. Create the following matrices (with MATLAB), and use them in the exercises that follow: a. Create a row vector called d from the second column of matrix a. b
4. Create the following matrices (with MATLAB), and use them in the exercises that follow: a. Create a row vector called d from the second column of matrix a. b
4. Create the following matrices (with MATLAB), and use them in the exercises that follow: a. Create a row vector called d from the second column of matrix a. b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site