Matlab File Vikash
Matlab File Vikash
(MATLAB FILE)
B.TECH SEMESTER – VI
(Code: BECC-0805)
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.
Source Code:
Conclusion:
The Linear Convolution of 2-input sequences is obtained and plotted using MATLAB.