Adc Lab 3

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

Lab 3: Generating Sawtooth wave along with EVEN and

ODD functions

Task 1
Sawtooth wave
Plot the Graph of sawtooth waveform

MATLAB Code:
A=1
; w0=10*pi;
w=0.5;
t=0:0.001:1;
tri=sawtooth(w0*t,w);
plot(t,tri,’r’);
grid
axis([0,1,-1,1])
xlabel(’time’)
ylabel(’Amplitude’)
legend(’M. Naveed’)

Graph:
1
M. Naveed
0.8

0.6

0.4

0.2
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time
results:
Hence, we have obtained the sawtooth waveform.

Task 2
Even and Odd
Plot graph for even and odd part of following equation.

y = f (x) = x

MATLAB Code:
x=-1:0.001:1;
y1=sqrt(x);
y2=sqrt(-x);
subplot(2,2,1);
plot(x,y1,’r’);
subplot(2,2,1);
plot(x,y1,’r’);
subplot(2,2,2);
plot(x,y2,’b’);
xe=(y1-y2)/2;
subplot(2,2,3);
plot(xe,’b’);
legend(’M. Naveed’)
xo=(y1+y2)/2;
subplot(2,2,4)
; plot(xo,’k’);
legend(’M. Naveed’)
Graph:

1 1

0.5 0.5

0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1

0.5 0.6
M. Naveed M. Naveed

0.4
0
0.2

-0.5 0
-0.5 0 0.5 0 0.2 0.4 0.6

result:
Hence, we have obtained the even and odd part of given equation .

Task 3
Rectangular Pulse
Plot the graph which shows rectangular pulse.

MATLAB Code:
fs=10000;
t=-1:1/fs:1;
x2=rectpuls(t,20e-3)
x2=rectpuls(t,20e-3);
plot(t,x2);
axis([-0.1,0.1,-0.2,1.2]);
xlabel(’Time (sec)’);
ylabel(’Amplitude’);
legend(’M. Naveed’);

Graph:

1 M. Naveed
Amplitude

0.5

-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
Time (sec)

result
Hence, we have obtained the rectangular pulse.

Task 4
EVEN and ODD
Plot the graphs for even and odd of following equation:

x = 0.02Xexp(t)

MATLAB Code
t=-5:0.001:5;
x1=0.002*exp(t);
x2=0.002*exp(-t);
xe=(x1+x2)/2;
xo=(x1-x2)/2;
subplot(2,2,2);
plot(t,x1,’b’);
xlabel(’t’);
ylabel(’x(t)’);
title(’Signal x(t)’);
subplot(2,2,1);
plot(t,x2,’k’);
xlabel(’t’);
ylabel(’x(t)’);
title(’Signal x(-t)’);
subplot(2,2,3);
plot(t,xe,’r’);
xlabel(’t’);
ylabel(’x(t)’);
legend(’M. Naveed’);
title(’even part signal x(t)’);
subplot(2,2,4);
plot(t,xe,’r’);
subplot(2,2,3);
plot(t,xe,’r’);
subplot(2,2,4);
plot(t,xo,’m’);
xlabel(’t’);
ylabel(’x(t)’);
legend(’M. Naveed’);
title(’odd part signal x(t)’);
subplot(2,2,3);
plot(t,xe,’r’);
xlabel(’t’);
ylabel(’x(t)’);
title(’even part signal x(t)’);
legend(’M. Naveed’);
Graph:
Signal x(-t) Signal x(t)
0.3 0.3

0.25 0.25

0.2 0.2
x(t)

x(t)
0.15 0.15

0.1 0.1

0.05 0.05

0 0
-5 -4 -3 -2 -1 0 1 2 3 4 5 -5 -4 -3 -2 -1 0 1 2 3 4 5
t t

even part signal x(t) odd part signal x(t)


0.15 0.15
M. Naveed M. Naveed
0.1

0.1 0.05
x(t)

x(t)
0

0.05 -0.05

-0.1

0 -0.15
-5 -4 -3 -2 -1 0 1 2 3 4 5 -5 -4 -3 -2 -1 0 1 2 3 4 5
t t

result
Hence, we have obtained the even and odd graphs for given equation.

Analysis:
After this, we can analysis that is this equation is odd or even.

Conclusion:
In this lab experiment we have ploted graphs the Even and Odd signals. Moreover, we also
understand the concept of Even and Odd signals.

You might also like