Since, for Figure 3.4, we set the x-range to vary from 0 to 2π, we can reflect that by adding an x-label by using the following command:

xlabel('0 < x < 2\pi')

MATLAB will read ‘\pi’ as a command to insert the π symbol. Similarly, for the y-axis, we could tell MATLAB to give it a text label using the following command:

ylabel('Sine of x')

To give the whole plot a title, you could use the following command as an example, which you can modify to your liking rather intuitively:

title('Plot of the Sine Function','FontSize',12)

You can also create new lines on an existing graph by using a transformation. For instance, if you want to transform the y-curve by π/4 to the left, you could set a new variable y2 to be:

y2 = sin(x + pi/4);

You can then use a modified plot command to display y and y2 on the same set of axes:

plot(x,y,x,y2)

In order to display which line belongs to which function, you would need to set a legend:

legend('sin(x)','sin(x-\pi/4)')