Vous êtes sur la page 1sur 2

ECX-316 DIGITAL SIGNAL PROCESSING LABORATORY February 15, 2018

EXPERIMENT NO. 5
Aim of Experiment: To generate a discrete square wave using sine and cosine
function.

Software Required: MATLAB software version 2012A

Theory:
A square wave is a non-sinusoidal periodic waveform in which the amplitude alternates
at a steady frequency between fixed minimum and maximum values, with the same
duration at minimum and maximum. Although not realizable in physical systems, the
transition between minimum and maximum is instantaneous for an ideal square wave.
The square wave is a special case of a pulse wave which allows arbitrary durations at
minimum and maximum. The ratio of the high period to the total period of a pulse wave
is called the duty cycle. A true square wave has a 50% duty cycle (equal high and low
periods).

Code:

n=0:1:24;
N=8;
fn=1/2;
i=0+i;
for k=1:N-1
fn=fn+(1/N)*((1-exp(-i*pi*k))/(1-exp(-
2*i*pi*k/N)))*exp(2*pi/N*k*n*i);
end
stem(n,fn);
axis([0 21 0 2]);
title('SQUARE WAVEFORM 15102088');
xlabel('SAMPLE');
ylabel('AMPLITUDE');

Department of Electronics & Communication Engineering


9
Dr. BR Ambedkar National Institute of Technology, Jalandhar
ECX-316 DIGITAL SIGNAL PROCESSING LABORATORY February 15, 2018

Derivation:

Conclusion: Discrete square wave is generated successfully.

Department of Electronics & Communication Engineering


10
Dr. BR Ambedkar National Institute of Technology, Jalandhar

Vous aimerez peut-être aussi