0% found this document useful (0 votes)
12 views18 pages

Practical No 1

The document describes representations of various common signal waveforms in MATLAB. It includes: 1) Definitions and MATLAB code to generate sine, cosine, increasing/decreasing exponential, ramp, unit step, unit impulse and signum waveforms. 2) Plots of the continuous and discrete representations of each waveform. 3) Explanations of the characteristics and applications of exponential, ramp, unit step and unit impulse signals.

Uploaded by

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

Practical No 1

The document describes representations of various common signal waveforms in MATLAB. It includes: 1) Definitions and MATLAB code to generate sine, cosine, increasing/decreasing exponential, ramp, unit step, unit impulse and signum waveforms. 2) Plots of the continuous and discrete representations of each waveform. 3) Explanations of the characteristics and applications of exponential, ramp, unit step and unit impulse signals.

Uploaded by

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

Practical No.

1
Aim: Representation of Signals

Name- Aditya Pramod Nagane

Batch- A4

UID- 2023201001

Software Used- Matlab

Table of Contents
Aim: Representation of Signals ............................................................................................................................... 1
Part- A...................................................................................................................................................................... 1
Sine Waveform......................................................................................................................................................... 1
Cosine Waveform..................................................................................................................................................... 2
Incresing Exponential Waveform.............................................................................................................................. 4
Decreasing Exponential Waveform...........................................................................................................................5
Ramp Function......................................................................................................................................................... 6
Unit Step Waveform..................................................................................................................................................7
Unit Impulse Waveform.............................................................................................................................................8
Signum Waveform.................................................................................................................................................... 9
Random Waveform................................................................................................................................................. 10
Square Waveform................................................................................................................................................... 11
Sinc Waveform........................................................................................................................................................13
Part- B ............................................................................................................................................................ 14
Product of Waves....................................................................................................................................................14
Addition of Waves................................................................................................................................................... 16
Conclusion.............................................................................................................................................................. 18

Part- A

Sine Waveform
Theory:

• The sine wave is defined by the trigonometric function sin(θ), where θ represents the angle measured in
radians.
• It has a characteristic waveform with peaks and troughs, resembling a smooth oscillation.
• The sine function oscillates between -1 and 1, and its period is 2π radians.
• Sine waves are often used to represent simple harmonic motion and natural oscillations.

Results

x=0:pi/20:5*pi;
y=sin(x)

y = 1×101
0 0.1564 0.3090 0.4540 0.5878 0.7071 0.8090 0.8910

1
subplot(2,1,1)
plot(y)
subplot(2,1,2)
stem(y)

subplot(2,1,1)
title("Continuous Waveform")
xlabel("X")
ylabel("sin(x)")
subplot(2,1,2)
xlabel("X")
ylabel("sin(x)")
title("Discrete Waveform")

Cosine Waveform
Theory:

• The cosine wave is closely related to the sine wave and is defined by the trigonometric function cos(θ).
• It has a similar oscillatory nature to the sine wave but is shifted by 90 degrees or π/2 radians.
• The cosine function also oscillates between -1 and 1, and its period is also 2π radians.
• In signal processing, the cosine wave is often employed alongside the sine wave, and their phase
relationship is significant in defining complex waveforms.

2
Results

subplot(2,1,1)
plot(y)
subplot(2,1,2)
stem(y)
x=0:pi/20:5*pi;
y=cos(x)

y = 1×101
1.0000 0.9877 0.9511 0.8910 0.8090 0.7071 0.5878 0.4540

subplot(2,1,1)
plot(y)
subplot(2,1,2)
stem(y)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("X")
ylabel("cos(x)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("X")
ylabel("cos(x)")

3
Incresing Exponential Waveform
Theory:

Exponential signals showcase growth or decay over time. The increasing exponential signal denotes continuous
growth, while the decreasing counterpart signifies continuous decay. They are commonly utilized in fields such
as physics and finance, or an exponential signal or exponential function is a function that literally represents an
exponentially increasing or decreasing series.

• When � = 0, the exponential signal x(t) is a signal of constant magnitude for all times.
• When � > 0, i.e., � is positive, then the exponential signal x(t) is a growing exponential signal.
• When � < 0, i.e., � is negative, then the signal x(t) is a decaying exponential signal.

Results

x=0:0.2:10

x = 1×51
0 0.2000 0.4000 0.6000 0.8000 1.0000 1.2000 1.4000

y= exp(x)

y = 1×51
104 ×
0.0001 0.0001 0.0001 0.0002 0.0002 0.0003 0.0003 0.0004

subplot(2,1,1)
plot(x,y)
subplot(2,1,2)
stem(x,y)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("X")
ylabel("A ⋅ e^(k.x)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("X")
ylabel("A ⋅ e^(k.x)")

4
Decreasing Exponential Waveform
x=0:0.2:10

x = 1×51
0 0.2000 0.4000 0.6000 0.8000 1.0000 1.2000 1.4000

y=exp(-x)

y = 1×51
1.0000 0.8187 0.6703 0.5488 0.4493 0.3679 0.3012 0.2466

subplot(2,1,1)
plot(y)
subplot(2,1,2)
stem(y)
subplot(2,1,1)
title("Continuous Waveform")
subplot(2,1,2)
title("Discrete Waveform")
subplot(2,1,1)
title("Continuous Waveform")
xlabel("X")
ylabel("-A ⋅ e^(k.x)")
subplot(2,1,2)
title("Discrete Waveform")

5
xlabel("X")
ylabel("-A ⋅ e^(k.x)")

Ramp Function
Theory:

The ramp signal, characterized by a linear increase or decrease, is employed to represent gradual changes in
a system. They are often used to represent linearly varying quantities and the slope decides how fast the ramp
increases or decreases. They are commonly used in control systems and engineering applications, they provide
insights into linear processes such as motion or voltage changes.

Characteristics of Unit Ramp Signal

• Initial value of unit ramp signal is zero(0).


• Unit ramp signal is linear signal.
• Slope of unit ramp signal is positive, means unit ramp signal is positively increasing signal.
• Area under the unit ramp signal for time t=0 to t=T is T.

Results

x=0:1.5:50

x = 1×34
0 1.5000 3.0000 4.5000 6.0000 7.5000 9.0000 10.5000

6
subplot(2,1,1)
plot(x)
subplot(2,1,2)
stem(x)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("X")
ylabel("f(x)=m⋅x+c")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("X")
ylabel("f(x)=m⋅x+c")

Unit Step Waveform


Theory:

A unit step signal is also the step signal and one of the standard testing signals. A unit step signal is a specific
type of input signal used for analysis, testing and designing. The magnitude of the unit step signal is one. A
unit step signal can exist only for positive values and zero for negative values. In other words, let f(t) be a
function, then the value of f(t) will be 1 for t>0 (i.e., for negative values of t) and it will be zero for t<0 (i.e., for
negative values of t). It is one of the important signals for the analysis of the systems. Unit step signals can be
represented in both continuous and discrete-time systems.

Results

7
t = (-1:0.05:1);
unitstep = t>=0;
subplot(2,1,1)
plot(unitstep)
subplot(2,1,2)
stem(unitstep)
subplot(2,1,1)
title("Continous Waveform")
xlabel("t")
ylabel("δ(t)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("t")
ylabel("δ(t)")

Unit Impulse Waveform


Theory:

The unit impulse function, is a mathematical concept representing an instantaneous, infinitely narrow pulse.
They are extremely short discrete signal concentrated at one point and the height represents area under
impulse which is 1 unit. Widely used in signal analysis, it helps in understanding system responses to sudden
changes and used to measure voltage spikes.

Results

8
t = (-1:0.001:1)';
impulse = t==0;
subplot(2,1,1)
plot(impulse)
subplot(2,1,2)
stem(impulse)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("t")
ylabel("u(t)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("t")
ylabel("u(t)")

Signum Waveform
Theory:

The signum function characterizes the sign (positive, negative, or zero) of a given signal the output is 1 for
positive input, -1 for negative input. Which helps to models the sign of a variable, not its magnitude which is
used for assessing positivity/negativity.This signal is widely used in image processing and robotics.

Results

x = -65:65;

9
y=sign(x)

y = 1×131
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

subplot(2,1,1)
plot(x,y)
subplot(2,1,2)
stem(x,y)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("t")
ylabel("sign(t)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("t")
ylabel("sign(t)")

Random Waveform
Theory:

Random signals lack a predictable pattern, simulating real-world randomness and are not deterministic.They are
widely utilized in statistical analysis, communication channel modeling, and image processing, random signals
captures the uncertainty and variability present in diverse systems.

10
Results

t=rand(1,75)

t = 1×75
0.7749 0.8173 0.8687 0.0844 0.3998 0.2599 0.8001 0.4314

subplot(2,1,1)
plot(t)
subplot(2,1,2)
stem(t)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("t")
ylabel("x(t)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("t")
ylabel("x(t)")

Square Waveform
Theory:

11
Square waves represent periodic discrete pulses, oscillating between two constant values. They have high
energy density. They are found in in pulse-width modulated signals, clocks. Square signals encode information,
forming the basis of digital communication and data encoding.

Results

x=linspace(0,5*pi)

x = 1×100
0 0.1587 0.3173 0.4760 0.6347 0.7933 0.9520 1.1107

y=square(x)

y = 1×100
1 1 1 1 1 1 1 1 1 1 1 1 1

subplot(2,1,1)
plot(x,y)
subplot(2,1,2)
stem(x,y)
subplot(2,1,1)
title("Continuous Waveform")
xlabel("t")
ylabel("s(t)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("t")
ylabel("s(t)")

12
Sinc Waveform
Theory:

Sinc Wave is defined as sin(x)/x and exhibits damped oscillations and arises naturally when reconstructing
continuous signals. It finds its applications in signal processing, particularly in filter design and Fourier transform
analysis.Due to its oscillatory behavior and finite support, the sinc signal plays a vital role in shaping filter
responses.

Results

x=-5:0.1:5

x = 1×101
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000

y=sinc(x)

y = 1×101
0.0000 0.0201 0.0390 0.0548 0.0658 0.0707 0.0688 0.0599

subplot(2,1,1)
plot(y)
subplot(2,1,2)
stem(y)
subplot(2,1,1)
title("Continuous Waveform")

13
xlabel("x")
ylabel("sinc(x)")
subplot(2,1,2)
title("Discrete Waveform")
xlabel("x")
ylabel("sinc(x)")

Part- B

Product of Waves
Theory:

When we multiply two waves, we perform a modulation where the amplitudes, frequencies, and phases interact.
The resulting waveform reflects both the sum and difference frequencies, influencing the overall shape. This
multiplication process is used in various applications, such as amplitude modulation and frequency mixing in
signal processing.

Results

t=0:0.01:3*pi;
a=sin(2*pi*1*t)

a = 1×943
0 0.0628 0.1253 0.1874 0.2487 0.3090 0.3681 0.4258

14
b=cos(2*pi*3*t)

b = 1×943
1.0000 0.9823 0.9298 0.8443 0.7290 0.5878 0.4258 0.2487

z=a.*b

z = 1×943
0 0.0617 0.1165 0.1582 0.1813 0.1816 0.1567 0.1059

subplot (3,1,1)
plot(t,a)

subplot (3,1,2)
plot(t,b,'red')
subplot (3,1,3)
plot(t,z,'green')
subplot(3,1,1)
title("Waveform A (1Hz sine wave)")
xlabel("t")
ylabel("f(t)")
subplot(3,1,2)
title("Waveform B (5Hz cosine wave)")
xlabel("t")
ylabel("f(t)")
subplot(3,1,3)
title("Product of Waveforms")

15
xlabel("t")
ylabel("f(t)")

Addition of Waves
Theory:

When we add two waves, we're combining their amplitudes, frequencies, and phases through superposition. If
amplitudes and phases align, we get constructive interference, resulting in a larger amplitude. If they oppose,
destructive interference occurs, leading to a smaller amplitude or cancellation.These principles of wave addition
are used in signal processing and find its applications in modulation, filtering, and Fourier analysis.

Results

t=0:0.01:3*pi;
a=sin(2*pi*1*t)

a = 1×943
0 0.0628 0.1253 0.1874 0.2487 0.3090 0.3681 0.4258

b=cos(2*pi*3*t)

b = 1×943
1.0000 0.9823 0.9298 0.8443 0.7290 0.5878 0.4258 0.2487

z=a+b

z = 1×943

16
1.0000 1.0451 1.0551 1.0317 0.9777 0.8968 0.7939 0.6745

subplot (3,1,1)
plot(t,a,'red')
subplot (3,1,2)
plot(t,b)
subplot (3,1,3)
plot(t,z,'green')
subplot(3,1,1)
title("Waveform A (1Hz sine wave)")
xlabel("t")
ylabel("f(t)")
subplot(3,1,2)
title("Waveform B (5Hz cosine wave)")
xlabel("t")
ylabel("f(t)")
subplot(3,1,3)
title("Sum of Waveforms")
xlabel("t")
ylabel("f(t)")

17
Conclusion

18

You might also like