0% found this document useful (0 votes)
13 views9 pages

Lab 1

The document outlines an experimental study using MATLAB to implement and visualize various signals including unit step, impulse, ramp, sinusoidal, exponential, and exponentially damped sinusoidal signals. It details the objectives, theoretical definitions, lab tasks with corresponding MATLAB code, observations, and discussions on the characteristics of each signal. The conclusion emphasizes the effectiveness of MATLAB in illustrating the unique properties of these basic signals.

Uploaded by

2204002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views9 pages

Lab 1

The document outlines an experimental study using MATLAB to implement and visualize various signals including unit step, impulse, ramp, sinusoidal, exponential, and exponentially damped sinusoidal signals. It details the objectives, theoretical definitions, lab tasks with corresponding MATLAB code, observations, and discussions on the characteristics of each signal. The conclusion emphasizes the effectiveness of MATLAB in illustrating the unique properties of these basic signals.

Uploaded by

2204002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Experiment No.

01
Experiment Name: Experimental study of (i) Unit step signal (ii) Impulse signal (iii) Ramp
signal (iv) Sinusoidal Waves (v) Exponential Signal (vi) Exponentially Damped Sinusoidal
Signal by using ‘MATLAB’.

Objectives:
 To implement the unit step signal, impulse signal, ramp signal, sine signal, cosine
signal, exponential signal by MATLAB.
 To implement the continuous and discrete version of sine signal, cosine signal and
exponential signal by MATLAB.

Theory:
Unit Step Signal:
Unit Step Signal is a signal that originates at zero and makes an instantaneous transition to
one at time t = 0 in continuous domain and at n = 0 at discrete domain. It is denoted as u(t) in
continuous time and as u[n] in discrete time. It is defined as:

Continuous: u(t) = {01,, forfor tt<≥ 00


Discrete: u[n] = {01,, forfor nn<0≥ 0
Impulse Signal:
The unit impulse signal, commonly denoted as δ(t) in continuous time or δ[n] in discrete
time, represents an exceedingly brief pulse. Its distinctive feature is that the integral (or sum,
in the discrete case) over its entire domain is equal to 1. It is defined as:

Continuous: ∫ δ ( t ) ⅆt =1
−∞


Discrete: ∑ δ [ n ]=1
n=−∞

Ramp Signal:
The ramp function is a mathematical signal that increases linearly with time in the
continuous-time domain or with the index in the discrete-time domain. It is often denoted as
r(t) in continuous time or r[n] in discrete time. It is defined as:

Continuous: r(t) = {0t ,,forfortt≥<00


Discrete: r[n] = {0n ,,forfor nn<0≥ 0
Sinusoidal Wave:
The continuous time version of a sinusoidal signal, in its most general form, may be written
as
x(t) = A cos (ꞷt + Ꟙ)
where A is the amplitude, ꞷ is the frequency in radians per second, and Ꟙ is the phase angle
in radians per second.
Exponential Signal:
A real exponential signal, in its most general form, is written as
x(t) = Be at
where both B and a are real parameters. The parameters B is the amplitude of the exponential
signal measured at time t = 0.
Exponentially Damped Sinusoidal Signal:
The multiplication of a sinusoidal signal by a real-valued decaying exponential signal results
in a new signal referred to as an exponentially damped sinusoidal signal. Specifically,
multiplying the continuous-time sinusoidal signal Asin(ꞷt + Ꟙ) by the exponential e−αt
results in the exponentially damped sinusoidal signal
x(t) = Ae−αt sin(ꞷt + Ꟙ), α>0

Lab Tasks:

Lab Task 1 – Plot a Unit Step Signal


Code:

clc;
clear all;
close all;

%time initialize
t = -5:0.07:5;

%unit step signal function


u = t >= 0;

%for discrete time signal


stem(t, u, 'black', Linewidth = 1.5);
grid on;

title('Unit Step Signal');

xlabel('Time (t)');
ylabel('Amplitude');

axis([-5 5 -0.5 1.5]);


Output:
Unit Step Signal
1.5

1
Amplitude

0.5

-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (t)

Observation:
The output is generated using the logical condition ( t >= 0). This condition generates 1 for
positive t and 0 otherwise. It covers a time range of -5 to 5. The code employs a method to
illustrate the concept of a unit step signal in MATLAB.
Lab Task 2 – Plot Impulse Signal
Code:
clc;
clear all;
close all;

%time initialize
t = -5:0.1:5;

%impulse signal function


impulse = (t == 0);

%to plot discrete time signal


stem(t, impulse, 'b', Linewidth = 1.5);

grid on;

title('Impulse Signal');

xlabel('Time (t)');
ylabel('Amplitude');

axis([-5 5 -0.5 1.5]);


Output:
Impulse Signal
1.5

1
Amplitude

0.5

-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (t)

Observation:
This output is generated using logical condition (t == 0). This condition generates 1 for n is
zero (0) and 0 otherwise. It covers a time range of -5 to 5. The code employs a method to
illustrate the concept of an impulse signal in MATLAB.

Lab Task 3 – Plot a Ramp Signal


Code:
clc;
clear all;
close all;

t = -5:0.1:5;

ramp = t .* (t >= 0); %ramp signal function


subplot(2,1,1);

plot(t, ramp, 'b', Linewidth = 1.5); %for continuous time

grid on;
title('Ramp Signal');
xlabel('Time (t)');
ylabel('Amplitude');
axis([-5 5 -0.5 5.5]);

subplot(2,1,2);

stem(t, ramp, 'b', Linewidth = 1.5); %for discrete time

grid on;
title('Ramp Signal');
xlabel('Time (t)');
ylabel('Amplitude');
axis([-5 5 -0.5 5.5]);
Output:
Ramp Signal
5
4
Amplitude

3
2
1
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (t)
Ramp Signal
5
4
Amplitude

3
2
1
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (t)

Observation:
This output is generated by multiplying t with the unit step function (t >= 0). It results in a
ramp signal starting from 0. Here I used plot and stem syntax for getting continuous time
ramp signal and discrete time ramp signal accordingly. It covers a time range of -5 to 5.
The code employs a method to illustrate the concept of an impulse signal in MATLAB. The
code effectively visualizes the differences between continuous and discrete signals in the
time domain.

Lab Task 4 – Plot Sinusoidal Wave


Code:
clc;
clear all;
close all;
t = 0:0.01:1;
A = 1;
f = 2;
p = 0;
x = A * sin(2*pi*f*t + p);
subplot(2,2,1);
plot(t, x, 'b', LineWidth=1.5);
grid on;
title('Continuous-time Sine Wave');
xlabel('Time (t)');
ylabel('Amplitude');
subplot(2,2,2);
stem(t, x, 'r', LineWidth=1.5);
grid on;
title('Discrete-time Sine Wave');
xlabel('Time (t)');
ylabel('Amplitude');

y = A * cos(2*pi*f*t + p);
subplot(2,2,3);
plot(t, y, 'b', LineWidth=1.5);
grid on;
title('Continuous-time Cosine Wave');
xlabel('Time (t)');
ylabel('Amplitude');
subplot(2,2,4);
stem(t, y, LineWidth=1.5);
grid on;
title('Discrete-time Cosine Wave');
xlabel('Time (t)');
ylabel('Amplitude');
Output:
Continuous-time Sine Wave Discrete-time Sine Wave
1 1

0.5 0.5
Amplitude

Amplitude
0 0

-0.5 -0.5

-1 -1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Time (t) Time (t)
Continuous-time Cosine Wave Discrete-time Cosine Wave
1 1

0.5 0.5
Amplitude

Amplitude

0 0

-0.5 -0.5

-1 -1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Time (t) Time (t)

Observation:
Plots of continuous and discrete sine waves are produced in the first two subplots by the
above MATLAB code, while plots of continuous and discrete cosine waves are produced in
the final two subplots. Whereas the discrete sine and cosine waves are shown with stems,
the continuous ones are shown with solid lines. The discrete versions of the plots display a
sampled representation of the continuous waveforms, demonstrating the periodic nature of
the sine and cosine functions. In the time domain, the code successfully illustrates the
distinctions between continuous and discontinuous signals.

Lab Task 5 – Plot an Exponential Signal


Code:
clc;
clear all;
close all;
t = 0:0.05:3;
B = 4;
a = 5;

x = B * exp(a*t);
subplot(2,1,1);
plot(t,x,'b',LineWidth=1.5);
title("Continuous time Exponential Signal");
xlabel("Time");
ylabel("Amplitude");
grid on;
subplot(2,1,2);
stem(t,x,'r',LineWidth=1.5);
title("Discrete time Exponential Signal");
xlabel("Time");
ylabel("Amplitude");
grid on;
Output:
106 Continuous time Exponential Signal
15
Amplitude

10

0
0 0.5 1 1.5 2 2.5 3
Time
106 Discrete time Exponential Signal
15
Amplitude

10

0
0 0.5 1 1.5 2 2.5 3
Time

Observation:
This code generates plots of continuous and discrete time exponential signal in two
subplots. The continuous exponential signal is represented with solid lines, while the
discrete versions are depicted with stems. The code effectively visualizes the differences
between continuous and discrete signals in the time domain.

Lab Task 6 – Plot an Exponentially Damped Sinusoidal Signal


Code:
clc;
clear all;
close all;
t = 0:0.01:10;
A = 1;
b = 0.8;
f = 2;
p = 0;
x = A * exp(-b*t) .* sin(2*pi*f*t+p);
plot(t,x,'b',LineWidth=1.5);
title("Exponentialy Damped Sinusoidal Signal");
xlabel("Time");
ylabel("Amplitude");
grid on;

Output:
Exponentialy Damped Sinusoidal Signal
1

0.8

0.6

0.4
Amplitude

0.2

-0.2

-0.4

-0.6

-0.8
0 1 2 3 4 5 6 7 8 9 10
Time

Observation:
This code generates plots of continuous time exponentially damped sinusoidal signal. The
continuous exponentially sinusoidal signal is represented with solid lines. The code
effectively visualizes how is the exponentially damped sinusoidal signal.

Used Functions in MATLAB:

Command Used Description


This MATLAB function clears all the text from
clc (Clear Command Window) the Command Window, resulting in a clear
screen.
This MATLAB function removes all variables
clear all from the current workspace, releasing them
from system memory.
This MATLAB function closes the current
close all
figure.
+ Adds numbers or matrixes.
- subtracts numbers or matrixes.
* multiplies numbers or matrixes.
/ Divides numbers or matrixes.
; Used to hide anything from command window.
plot Plots a set of data points.
subplot Creates subplots within a figure.
title Sets the title of a plot.
xlabel Adds a label to the x-axis of a plot.
ylabel Adds a label to the y-axis of a plot.
Plot discrete sequence data. This MATLAB
stem function plots the data sequence, Y, as stems
that extend from a baseline along the x-axis.

Discussion:
The exponentially damped sinusoidal wave, unit step, unit impulse, ramp, sine and cosine
waves, and exponential signal were all represented in MATLAB. While the Unit Step signal
started at zero and changed to one instantly, the Unit Impulse signal represented an
infinitesimally brief pulse with an integral equal to 1. The ramp signal increased steadily and
linearly over time. While the sine and cosine waves displayed their periodic nature, the
exponential signal displayed exponential growth or decline. These signals were successfully
shown using MATLAB-generated charts, providing a comprehensive understanding of their
characteristics.
Conclusion:
Basic signals may be clearly represented in the plots generated by MATLAB, which makes it
possible to comprehend their special characteristics. This activity has made it possible to gain
a deeper understanding of concepts such unit step transitions, impulse responses, linear ramp
behavior, and the periodicity of sine and cosine waves. It has also given insights into signal
processing processes.

You might also like