Part a)

Create an evenly spaced vector of values from 1 to 20 in increments of 1.

Matlab:

sv = 1:20

 

sv =

 

Columns 1 through 7

 

1     2     3     4     5     6     7

 

Columns 8 through 14

 

8     9    10    11    12    13    14

 

Columns 15 through 20

 

15    16    17    18    19    20

 

Part b)

Create a vector of values from zero to 2π in increments of π/10

Matlab:

v = [0:(pi/10):(2*pi)]

 

v =

 

Columns 1 through 4

 

0    0.3142    0.6283    0.9425

 

Columns 5 through 8

 

1.2566    1.5708    1.8850    2.1991

 

Columns 9 through 12

 

2.5133    2.8274    3.1416    3.4558

 

Columns 13 through 16

 

3.7699    4.0841    4.3982    4.7124

 

Columns 17 through 20

 

5.0265    5.3407    5.6549    5.9690

 

Column 21

 

6.2832

 

Part c)

Use the linspace command to create a vector containing 15 values, evenly spaced between 4 and 20.

Matlab:

cv = linspace(4,20,15)

 

cv =

 

Columns 1 through 4

 

4.0000    5.1429    6.2857    7.4286

 

Columns 5 through 8

 

8.5714    9.7143   10.8571   12.0000

 

Columns 9 through 12

 

13.1429   14.2857   15.4286   16.5714

 

Columns 13 through 15

 

17.7143   18.8571   20.0000

Part d)

 

Create a table of conversions from feet to meters. Start the feet column at 0, increment it by 1, and end it at 10 ft. (Note: 1 meter = 3.28 feet)

Matlab:

ft = [0:1:10]

mts = 0.3048.*ft

 

ft =

 

Columns 1 through 7

 

0     1     2     3     4     5     6

 

Columns 8 through 11

 

7     8     9    10

 

 

mts =

 

Columns 1 through 4

 

0    0.3048    0.6096    0.9144

 

Columns 5 through 8

 

1.2192    1.5240    1.8288    2.1336

 

Columns 9 through 11

 

2.4384    2.7432    3.0480

part e)

Create a table of conversions from m/h to ft/s. Start the mi/h column at 0 and end it at

100 mi/hr.  Print 15 values in your table. (Note:  22 ft/s = 15 m/h)

Matlab:

mi_h=[linspace(0,100,15)]

ft_s=(22/15).*mi_h

 

mi_h =

 

Columns 1 through 4

 

0    7.1429   14.2857   21.4286

 

Columns 5 through 8

 

28.5714   35.7143   42.8571   50.0000

 

Columns 9 through 12

 

57.1429   64.2857   71.4286   78.5714

 

Columns 13 through 15

 

85.7143   92.8571  100.0000

 

 

ft_s =

 

Columns 1 through 4

 

0   10.4762   20.9524   31.4286

 

Columns 5 through 8

 

41.9048   52.3810   62.8571   73.3333

 

Columns 9 through 12

 

83.8095   94.2857  104.7619  115.2381

 

Columns 13 through 15

 

125.7143  136.1905  146.6667