Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

LAB-03

OBJECTIVE:
To generate the 2D plotting by using MATLAB.

TASK 01:
t=0:0.1:1;
x=exp(-10.*t)
plot(t,x)
figure
plot(t,x,'M')
clc
figure
stem(t,x)
figure
stem(t,x,'^')
figure
subplot(221)
plot(t,x)
subplot(222) TASK02
stem(t,x,'r') t=0:1:50;
subplot(223) y1=sin(2*pi*t/8);
stem(t,x,'filled') y2=cos(2*pi*t/8);
subplot(224) figure plot(t,y1,'r')
stem(t,x,'*r') hold on
GRAPH: plot(t,y2,'g')
hold off
xlabel('time')
ylabel('amplitude')
title('two sinewaves')
axis([0 10 -1 1])
GRAPH:

TASK: 03
t=10:5:50;
y1=sin(2*pi*0.38*t);
y2=cos(2*pi*0.38*t);
figure plot(t,y1,'r')
hold on title('error bar plot')
plot(t,y2,'g') subplot(224)
hold off stair(x,y,'m')
xlabel('time') title('stairs plot')
ylabel('amplitude') figure
title('two sinewaves') scatter(x,y,'g')
%axis([0 10 -1 1]) title('scatter plot')
GRAPH: GRAPH:

TASK: 04:
t=0:0.2:20;
a=[sin(t).*cos(2.*t)]
area(a)
title('arae plot') TASK 06:
GRAPH: theta=[-pi/2*pi*2*pi]
r=[269]
polar(theta,r,'r--')
title('polar plot')
figure
compass(theta,r,'b--')
title('compass plot')
GRAPH:

TASK: 05:
x=[1 3 5 7 10 13 15]
y=[0 0.5 1 1.5 3 2 2]
figure
subplot(221)
bar(x,y,'r')
title('bar plot')
subplot(222)
bar(x,y,'g')
title('barh plot')
subplot(223)
error
bar(x,y,'b')
TASK 07
x=[10 20 25 40 75 80 90]
pie(x)
title('pie plot')

GRAPH:

Conclusion
In conclusion, MATLAB is a powerful tool for creating
2D plots. It simplifies data visualization, making it
easier to understand and present information
effectively.

You might also like