You are on page 1of 8

MATLAB

Lecture 8
2-D Line Plot
x = -pi:.1:pi;
y = sin(x);
plot(x,y)

X=-3.1416: 3.1416
2-D Line Plot
x = -pi:.1:pi;

plot(sin(x))
hold all
plot(cos(x))
2-D Line Plot
x = -pi:.1:pi;
y = sin(x);
plot(x,y)
set(gca,'XTick',-pi:pi/2:pi)
set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
title('Sine Function');
xlabel('Radians');
ylabel('Function Value');
2-D Line Plot
x = -pi:pi/10:pi;
y = tan(sin(x)) - sin(tan(x));
plot(x,y,'--rd', 'LineWidth',2,
'MarkerEdgeColor','k' , 'MarkerFaceColor', 'b',
'MarkerSize',10)
2-D Line Plot
x=[1 2 3 4 5]
y = x.^2
plot(x,y,':bs', 'LineWidth',2, 'MarkerEdgeColor',
'r' , 'MarkerFaceColor', 'c', 'MarkerSize',10)
2-D Line Plot
x=1:10:100
y = x.^2
plot(x,y,':bs', 'LineWidth',2, 'MarkerEdgeColor',
'r' , 'MarkerFaceColor', 'c', 'MarkerSize',10)
2-D Line Plot

You might also like