MATLAB: How can the graph area be represented horizontally line in the sin(x) graph line plot x = 0: pi/100 : 2*pi; y = sin(x); plot(x,y); title('\bf\ity = sin\rm\bf(\itx\rm\bf)'); xlabel('\bf\itx'); ylabel('\bf\ity'); grid on; Best Answer area(x,y,'facecolor','r') Related SolutionsMATLAB: How to add markers to a plot after using fzero I would use a loop to create a vector for āzā:x=-2*pi : 2*pi;y=3*x.*sin(x)-2*x; y1=3*sin(x)+3*x.*cos(x)-2;x0 = [-4, -2, 0, 2, 4];for k1 = 1:numel(x0) z(k1) = fzero('3*sin(x)+3*x.*cos(x)-2', x0(k1));endfigureplot(x,y,'-',x,y1, '--') hold onplot(z, zeros(size(z)), 'pg') hold offxlabel('\bf\itx-axis\rm') ylabel('\bf\ity-axis\rm') legend('y=3xsin(x)-2x','y1=3sin(x)+3xcos(x)-2', 'Location', 'S') MATLAB: How can i fix the error ‘Index exceeds the number of array elements (51)’ You need to apply elementwise division:x = [0:0.1:5];y = sin(x)./x;plot(x, y), xlabel('xi'), ylabel('Theta'), title('Solution to Lane Emden Equation'),grid on, axis equal;ax = gca; ylabel = texlabel(y); xlabel = texlabel(x); ax.XAxisLocation = 'origin'ax.YAxisLocation = 'origin' Related QuestionPlot the simple sin wave with amplitudeIs there a neat way (functions?) to plot 19 variables against each otherLegend for yyaxis at two different locationsFormat y axis on a graph
Best Answer