define a vector x going from -10 to 20 in increments of 0.5 in matlab

To define a vector x that goes from -10 to 20 in increments of 0.5, you can use the : operator to specify the range and the increment, and assign the result to x. Here is the code:

main.m
x = -10:0.5:20;
16 chars
2 lines

This will create a row vector x with size 61x1, starting at -10 and ending at 20 inclusive, with increments of 0.5.

gistlibby LogSnag