EXPERIMENT -3
Date:13/08/2018
PERIODIC AND APERIODIC SIGNALS
AIM: Generation of periodic and aperiodic signals.
SOFTWARE USED: MATLAB 9.5.7(2017a)
THEORY: Periodic Signals: A signal is said to be periodic if it is repeated over a cycle of
time or a regular interval of time.
Following are the periodic signals generated:
(i)Sine wave
Syntax: x1=sin(t);
(ii)Cosine wave
Syntax: x2=cos(t);
(iii)Sawtooth wave
Syntax: x3=sawtooth(t);
(iv)Square wave
Syntax: x4=square(t);
Aperiodic Signal | Non-periodic Signal : A signal is considered to be non-periodic or
aperiodic signal when it does not repeat its pattern over a period (i.e. interval of time).
Following are the aperiodic signals generated:
(i)Triangular pulse
Syntax:
y = tripuls(T); returns a continuous, aperiodic, symmetric, unity-height triangular pulse at
the times indicated in array T, centered about T=0 and with a default width of 1.
y = tripuls(T,w); generates a triangular pulse of width w.
y = tripuls(T,w,s) generates a triangular pulse with skew s, where –1 ≤ s ≤ 1. When s is 0, a
symmetric triangular pulse is generated.
(ii)Rectangular pulse
Syntax:
y = rectpuls(t); returns a continuous, aperiodic, unity-height rectangular pulse at the sample
times indicated in array t, centered about t = 0 and with a default width of 1. Note that the
interval of nonzero amplitude is defined to be open on the right, that is, rectpuls(-
0.5) = 1 while rectpuls(0.5) = 0.
y = rectpuls(t,w) generates a rectangle of width w.
MATLAB PROGRAM:
fs=20000; %sampling frequency
t=-2:1/fs:2;
x1=sin(2*pi*2*t); %sine wave
subplot(3,2,1);
plot(t,x1);
axis([-2.5 2.5 -1.5 1.5]);
xlabel('Time(sec)');
ylabel('Amplitude');
title('Periodic Sine Wave');
x2=cos(2*pi*3*t); %cosine wave
subplot(3,2,2);
plot(t,x2);
axis([-2.5 2.5 -1.5 1.5]);
xlabel('Time(sec)');
ylabel('Amplitude');
title('Periodic Cosine Wave');
x3=sawtooth(2*pi*4*t); %sawtooth wave
subplot(3,2,3);
plot(t,x3);
axis([-2.5 2.5 -1.5 1.5]);
xlabel('Time(sec)');
ylabel('Amplitude');
title('Periodic Sawtooth Wave');
x4=square(2*pi*5*t); %square wave
subplot(3,2,4);
plot(t,x4);
axis([-2.5 2.5 -1.5 1.5]);
xlabel('Time(sec)');
ylabel('Amplitude');
title('Periodic Square Wave');
w=2;
s=0;
y1=tripuls(t,w,s); %triangular pulse
subplot(3,2,5);
plot(t,y1);
axis([-2.5 2.5 0 1.5]);
xlabel('Time(sec)');
ylabel('Amplitude');
title('Aperiodic Triangular Wave');
y2=rectpuls(t,w); %rectangular pulse
subplot(3,2,6);
plot(t,y2);
axis([-2.5 2.5 0 1.5]);
xlabel('Time(sec)');
ylabel('Amplitude');
title('Aperiodic Rectangular Wave');
OUTPUT:
Periodic Sine Wave Periodic Cosine Wave
1 1
Amplitude
Amplitude
0 0
-1 -1
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Time(sec) Time(sec)
Periodic Sawtooth Wave Periodic Square Wave
1 1
Amplitude
Amplitude
0 0
-1 -1
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Time(sec) Time(sec)
Aperiodic Triangular Wave Aperiodic Rectangular Wave
1.5 1.5
Amplitude
Amplitude
1 1
0.5 0.5
0 0
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Time(sec) Time(sec)