MATLAB: Need help graphing this graph a cosine How do you graph y = cosx and y = 5 + cosx over the interval [0,4pi]? I also want to use the command "ylim([-2,7]) in order to view the graph clearly. I just installed Matlab and it is my first time using this software. Thanks Best Answer x = 0:0.01:4*pi;plot(x,cos(x));hold on;plot(x,5+cos(x));ylim([-2 7]) Related SolutionsMATLAB: How to plot a number of curves on the same plot %Examplex=0:0.1:10;y1=sin(x);y2=cos(x)plot(x,y1,'r',x,y2,'g');legend({'curv1','curv2'})Look atdoc plot MATLAB: How to input multiple lines on a graph In order to place mutliple plot on same figure we can use hold on functionalityAs a example x = linspace(-pi,pi);y1 = sin(x);y2 = cos(x);plot(x,y1); % first linehold on plot(x,y2); % second linehold off Related QuestionAm I get discontinuous plotWon’t plot the graphFormat y axis on a graphWhen I put legend for 3 functions it only shows 1 on the graphPlot 2D graphHow to mention function on plot
Best Answer