0% found this document useful (0 votes)
19 views

Plot

The document contains MATLAB code that plots multiple lines and curves on graphs using different colors, line styles, markers, and equations. The code divides the plotting into sections separated by hold off commands and includes a grid on command after each section. It plots various functions such as sine, cosine, and polynomials over different intervals with markers and hold on commands to overlay the plots.

Uploaded by

estevaomoraes
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Plot

The document contains MATLAB code that plots multiple lines and curves on graphs using different colors, line styles, markers, and equations. The code divides the plotting into sections separated by hold off commands and includes a grid on command after each section. It plots various functions such as sine, cosine, and polynomials over different intervals with markers and hold on commands to overlay the plots.

Uploaded by

estevaomoraes
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

plot(-5:.01:5, 4, '--rs','MarkerEdgeColor','k',...

'MarkerFaceColor','r',...
'MarkerSize',2);
hold on
plot(5:0.01:10, 10, '--rs','MarkerEdgeColor','r',...
'MarkerFaceColor','g',...
'MarkerSize',2);
hold on
plot(10:0.01:15, 3*sin(10:0.01:15),'--rs','MarkerEdgeColor','b',...
'MarkerFaceColor','g',...
'MarkerSize',2);
hold on
plot(15:0.01:21, (15:0.01:21), '--rs','MarkerEdgeColor','g',...
'MarkerFaceColor','g',...
'MarkerSize',2);
hold off
grid on

plot(-8:0.01:-4, -4,'-rs','MarkerEdgeColor','k','MarkerFacecolor','r','MarkerSize',2);
hold on
plot(-4:0.01:-2, 2*(-4:0.01:-2),'-rs','MarkerEdgeColor','r','MarkerFacecolor','g','MarkerSize',2);
hold on
plot(-2:0.01:0, 2*cos(-2:0.01:0),'-rs','MarkerEdgeColor','b','MarkerFacecolor','g','MarkerSize',2);
hold on
plot(0:0.01:2, 2*cos(0:0.01:2),'-rs','MarkerEdgeColor','g','MarkerFacecolor','g','MarkerSize',2);
hold on
plot(2:0.01:4, -2*(2:0.01:4),'-rs','MarkerEdgeColor','c','MarkerFacecolor','g','MarkerSize',2);
hold on
plot(4:0.01:8, -4,'-rs','MarkerEdgeColor','m','MarkerFacecolor','g','MarkerSize',2);
hold off
grid on

plot(-10:0.01:-7,-8,'--rs','MarkerEdgeColor','k',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
plot(-7:0.01:0, (-7:0.01:0),'--rs','MarkerEdgeColor','r',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on

plot(0:0.01:7, (0:0.01:7),'--rs','MarkerEdgeColor','g',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
plot(7:0.01:10,-8,'--rs','MarkerEdgeColor','k',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold off
grid on

plot(-10:0.01:-3, -2,'--rs','MarkerEdgeColor','k',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
plot(-3:0.01:1, 3,'--rs','MarkerEdgeColor','r',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on

plot(1:0.01:5, 2*(1:0.01:5),'--rs','MarkerEdgeColor','g',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
plot(5:0.01:7,-1,'--rs','MarkerEdgeColor','k',...
'MarkerFacecolor','r',...
'MarkerSize',2);
plot(7:0.01:10,(7:0.01:10),'--rs','MarkerEdgeColor','g',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
hold off

plot(-10:0.01:-2, power((-10:0.01:-2),2),'--rs','MarkerEdgeColor','k',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
plot(-2:0.01:1, 1,'--rs','MarkerEdgeColor','r',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on

plot(1:0.01:3, 2,'--rs','MarkerEdgeColor','g',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
plot(3:0.01:3,1,'--rs','MarkerEdgeColor','k',...
'MarkerFacecolor','r',...
'MarkerSize',2);
plot(3:0.01:10,power((3:0.01:10),2),'--rs','MarkerEdgeColor','g',...
'MarkerFacecolor','r',...
'MarkerSize',2);
hold on
hold off
grid on

stem(sin(0:2/pi:2*pi))
hold off
grid on

You might also like