Lab 1
Lab 1
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: ∫ δ ( 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:
Lab Tasks:
clc;
clear all;
close all;
%time initialize
t = -5:0.07:5;
xlabel('Time (t)');
ylabel('Amplitude');
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;
grid on;
title('Impulse Signal');
xlabel('Time (t)');
ylabel('Amplitude');
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.
t = -5:0.1:5;
grid on;
title('Ramp Signal');
xlabel('Time (t)');
ylabel('Amplitude');
axis([-5 5 -0.5 5.5]);
subplot(2,1,2);
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.
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.
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.
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.
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.