define a vector t that goes from 0 to 3.5 in matlab

To define a vector t that goes from 0 to 3.5 in steps of 1, you can use the linspace function:

main.m
t = linspace(0, 3.5, 4);
25 chars
2 lines

The first argument is the starting point, the second argument is the ending point, and the third argument is the number of points in the vector (including the starting and ending points).

In this case, we want a vector with 4 points (0, 1.1667, 2.3333, and 3.5) to cover a range from 0 to 3.5 inclusive.

related categories

gistlibby LogSnag