EXPERIMENT 6:
REPRESENTATION OF BASIC SIGNALS USING GNU OCTAVE
INTRODUCTION
GNU Octave is a high-level language, primarily intended for numerical computations. It provides
a convenient command line interface for solving linear and nonlinear problems numerically, and
for performing other numerical experiments using a language that is mostly compatible with
Matlab. It may also be used as a batch-oriented language.
Octave has extensive tools for solving common numerical linear algebra problems, finding the
roots of nonlinear equations, integrating ordinary functions, manipulating polynomials, and
integrating ordinary differential and differential-algebraic equations. It is easily extensible and
customizable via user-defined functions written in Octave’s own language, or using dynamically
loaded modules written in C++, C, Fortran, or other languages.
GNU Octave is also freely redistributable software. You may redistribute it and/or modify it
under the terms of the GNU General Public License (GPL) as published by the Free Software
Foundation.
Octave was written by John W. Eaton and many others. Because Octave is free software you are
encouraged to help make Octave more useful by writing and contributing additional functions
for it, and by reporting any problems you may have.
To start the experiment, please click: [Link]
AIM
To represent the basic signals using GNU Octave
OPROCEDURE
%sine wave
t=0:0.01:1;
%cosine wave
% Square wave
a=2;
b=a*sin(2*pi*2*t); t=0:0.01:1; t=0:0.01:1;
stem (t, b) a=2; a=2;
axis (-4 10 -10 10]) b=a*cos(2*pi*2*t); b=a*square(2*pi*2*t);
xlabel (‘time’); stem (t, b); stem (t, b);
ylabel (‘Amplitude’) xlabel ('time'); xlabel ('time');
title ('Sine wave') ylabel('Amplitude'); ylabel('Amplitude');
title ('Cos wave'); title ('Square Wave');
%sawtooth x2 = n>=0;
t=0:0.01:1; subplot (2, 2, 2);
a=2; stem (n, x2);
b=a*sawtooth(2*pi*2*t); xlabel ('time');
% Exponential waveform ylabel ('Amplitude');
stem (t, b);
t=0:0.01:1; title ('Unit Step');
xlabel ('time');
a=2;
ylabel('Amplitude'); % ramp signal
b=a*exp(2*pi*2*t);
title ('Sawtooth n=-5:5;
stem (t, b);
Wave'); x3=x2.*n;
xlabel ('time');
subplot (2, 2, 3);
ylabel('Amplitude');
` stem (n, x3);
title ('Exponential
Wave'); % unit step signal
%Convolution
x = [-1 3 -1 -2];
h = [-2 2 0 -1 1];
y = conv (x, h)
stem (y)
axis ([-4 10 -10 10])
grid on
xlabel ('Time')
ylabel ('Amplitude')
title ('Discrete Convolution')
EXERCISES
A. By using Octave program, find the output signal 𝑦(𝑡) and display it with respect to time
on waveform graph by apply the continuous convolution between 𝑥(𝑡) & ℎ(𝑡)which is
shown below:
B. By using Octave program, find the output signal 𝑦(𝑡) and display it with respect to time t
by apply the continuous convolution between 𝑥(𝑡) & ℎ(𝑡).
C. By using LabView program, apply the discrete convolution to find the output signal 𝑦[𝑛],
when the 𝑥[𝑛] and ℎ[𝑛] are given below:
D. By using MatLab program, apply the discrete convolution to find the output signal 𝑦[𝑛], when
the 𝑥[𝑛] and ℎ[𝑛] are shown below:
Sinewave