create a column vector that starts at 10, increments by -0.2 and ends at 1. in matlab

You can create a column vector with these specifications using the "colon operator" in MATLAB.

Here's the code to create the column vector:

main.m
vector = 10:-0.2:1;
vector = vector';
38 chars
3 lines

Explanation:

  • The 10:-0.2:1 expression creates a vector that starts at 10, decrements by 0.2, and ends at 1.
  • The ' transpose operator is used to convert the resulting row vector into a column vector.

The resulting column vector will be:

main.m
10.0
9.8
9.6
...
1.2
1.0
25 chars
7 lines

Note: The vector' statement is optional if you specifically need a column vector. If you can work with a row vector, you can omit it.

related categories

gistlibby LogSnag