Linked Questions

Popular Questions

I am trying to format my graph so that the border ends at the max x and max y so there is not extra space between them and the border. Also, I'm trying to completely replace my first plot command with my second one. Should I just delete my first plot? Currently, the second plot goes over my first plot, removing most of my formatting.

clear all, close all
 %%command to clear all variables and log history
 x = linspace(-pi, pi, 200);
 %creating x variable between - pi and 200 with pi distance between each
 %value
 y = sin(x) + cos(x);
 %Creating y varable with the help of x
 figure
 plot(x,y)
 title('2-D Plot')
 xlabel('Theta (in radians)')
 ylabel('Function Y')
 xlim([-pi pi])
 ylim([-1.414 1.414])
 grid
 plot(x,y,'r--')
 grid

Related Questions