Matlab File Ritu
Matlab File Ritu
(MATLAB FILE)
B. TECH SEMESTER – VI
(Code: BECC-0805)
NAME- Ritu
SECTION- C
ROLL NO.- 24
UNIVERSITY ROLL NO.- 2113100022
Objective: To plot the unit impulse and unit step function using MATLAB.
Theory: The step signal or step function is that type of standard signal which exists only for
positive time and it is zero for negative time. In other words, a signal x(t) is said to be step signal
if and only if it exists for t > 0 and zero for t < 0. The step signal is an important signal used for
analysis of many systems.
0, t<0}
An ideal impulse signal is a signal that is zero everywhere but at the origin (t = 0), it is infinitely
high. Although, the area of the impulse is finite. The unit impulse signal is the most widely used
standard signal used in the analysis of signals and systems.
0, t ≠ 0}
Source code:
clc; close
all; clear
all; n = -
3:3;
x= [zeros (1,3) 1 zeros (1,3)];
subplot (2,2,1); stem (n, x);
xlabel ('time ----->');
ylabel('amplitude');
title ('unit impulse function'); %---------------------------------------
N=input ('enter the value');
n=0: N-1; x=ones (1, N);
subplot (2,2,4); stem(n,x);
xlabel ('time ----->');
ylabel('amplitude'); title
('unit STEP function');
Simulation results:
Conclusion: The unit impulse and unit step function have been plotted using MATLAB.
EXPERIMENT 2
Theory: The discrete Fourier transform (DFT) converts a finite sequence of equally spaced
samples of a function into a same-length sequence of equally-spaced samples of the discrete-time
Fourier transform (DTFT), which is a complex-valued function of frequency. The interval at which
the DTFT is sampled is the reciprocal of the duration of the input sequence. The DFT is therefore
said to be a frequency domain representation of the original input sequence.
Source code:
clc; close all; clear all;
x = input('enter the four point sequence');
function X = DFT(x,N);
j = sqrt(-1);
N = numel(x);
X = zeros(1,N);
for K = 1:N
s = 0;
for n =1:N
s =s + x(n)*exp(-j*((2*pi)/N)*(n-1)*(K-1));
end
X(K) = s;
end
%calculating the magnitude
X_mag= abs(X);
% calculating the phase
X_real = real(X);
X_img = imag(X);
X_phase = atan(X_img./X_real);
%plotting the magnitude spectrum
subplot(2,1,1);
stem(X_mag);
title('magintude spectrum');
subplot(2,1,2);
stem(X_phase);
title('phase spectrum');
Simulation results: x(n)=[1 0 -1 1]
Theory: Circular convolution, also known as cyclic convolution, is a special case of periodic
convolution, which is the convolution of two periodic functions that have the same period.
Periodic convolution arises, for example, in the context of the discrete-time Fourier transform
(DTFT).
Generally, there are two methods, which are adopted to perform circular convolution and
they are −
• Concentric circle method,
• Matrix multiplication method.
Source Code:
Inputs:
X1 : [1 2 3 4]
X2: [1 -1 1 -1]
Simulation Results:
Conclusion:
The Circular Convolution of Two Sequences have been obtained using MATLAB.
EXPERIMENT 4
Objective: To compute and plot Linear Convolution of input sequence using MATLAB.
Theory: Convolution is a mathematical operation on two functions (f and g) that produces a third
function. The term convolution refers to both the result function and to the process of computing
it. It is defined as the integral of the product of the two functions after one is reflected about the y-
axis and shifted. The integral is evaluated for all values of shift, producing the convolution
function. The choice of which function is reflected and shifted before the integral does not change
the integral result. Graphically, it expresses how the 'shape' of one function is modified by the
other.
The convolution of f and g is written f*g, denoting the operator symbol *. It is defined as the
integral of the product of two functions after one is reflected about y-axis and shifted. As such, it
is a particular kind of integral transform:
Source Code:
Conclusion:
The Linear Convolution of 2-input sequences is obtained and plotted using MATLAB.