In many applications, you need to perform calculations on a list of values between an upper and lower bound. A list of values is also known as a vector. Often the values are separated by a common spacing. Take for example plotting the quadratic equation used previously to calculate the roots. To make this plot, you need a list of x and y values with enough points to lead to a smooth plot. To accomplish this task, you need to create a uniformly space vector, and know how to perform calculations on an entire vector. Let's see how to do that. To create a plot, you need a list of values for x and y. You could do this by calculating an entering each value individually. In MATLAB, you can create a vector by entering the sequence of values placed within square brackets and separating the values with commas. However, this would be very time-consuming. Instead, you can quickly create uniformly space vectors using the colon operator. Start by creating a vector of values for x with a lower bound of negative two and an upper bound of two. If you insert a colon between the upper and lower bounds, the result is a row vector containing values starting at negative two ending at two and with the default spacing of one. A plot with only five points won't be very smooth. More points are needed which means using a different spacing. In that case, you include the spacing value between the two endpoints and separate everything with a colon. For example, here you create a vector of values with a spacing of 0.3. When the spacing does not divide the interval evenly as is the case here, the result is a vector of uniformly spaced values that begins at the lower bound but ends before the upper bound which is not included. If the spacing is changed to 0.1, the result is a vector of 41 elements starting at negative two and ending at the upper bound of two, because this time the spacing divides the interval evenly. Great, you created the vector of x values using the colon operator. But do you still have to calculate the y-values individually? Well, try using the vector x and a calculation the same way you previously used just numbers and see what happens. What's going on? Here you need to square each element of x. Well, no problem. With one small change, you can perform element-wise operations. Take these two vectors as an example. To multiply the corresponding elements of v1 and v2, use the element-wise multiplication operator. Similarly, you can do element-wise division and exponentiation, by adding a dot before the division and power operators. There are no special operators for element-wise addition and subtraction because they are the same for scalars or numbers, and vectors and matrices. There are a couple of common mistakes to watch out for. Its easy to forget the dot when doing element-wise operations, or to accidentally use vectors of different sizes. When this happens you get an error message about matrix dimensions, what? Don't worry. If you're not using matrices but get a matrix dimension error while trying to perform an operation on corresponding elements of two vectors, check that you're using the element-wise operators that you're vectors have the same number of elements and that the vectors are both row or both column vectors. Now back to that function you want to plot. Since x is a vector, you need to use the element-wise power operator to square each element of x. Let's see how this expression is evaluated. First, each element of x is squared. Then each element of the two vectors is multiplied by the scalars three and two. Finally, when adding or subtracting scalars and vectors, the scalar is automatically expanded to match the size of the vector before performing the addition or subtraction, and there you go. Using element-wise operations, you create a vector of y-values calculated for each point in x. Now, this plot accurately represents the function. To recap, you can use the colon operator to create a vector of evenly spaced x-values and element-wise operators to calculate all the y-values in a single expression. This will be especially helpful later when you need to select subsets of your data and perform calculations on them.