112k views
1 vote
What is the Matlab command to create a column vector with 11 equally spaced elements, whose first element is 2 and whose last is 32.

User Groundlar
by
6.6k points

1 Answer

5 votes

Answer:

transpose(linspace(2,32,11))

Step-by-step explanation:

To get the equally spaced elements you can use:

linspace is the command for generating a linearly spaced vector.

For instance, the command:

linspace(element1,element2,n)

generates n points, between element1 and element2

The spacing between the points is calculated by


(element2-element1)/(n-1)

In your case, the linspace command will create a vector with 1 row and 11 columns (1x11).

To get the column vector:

In order to convert this vector into one with 11 rows and 1 column (11x1), you can use:

tanspose(vector)

where vector is linspace(element1,element2,n)

User Chris Madden
by
7.4k points