SlideShare a Scribd company logo
1 of 10
Download to read offline
NAME :
REG.NO : 19BEC0858
COURSE CODE : ECE2006
COURSE TITLE : DIGITAL SIGNAL PROCESSING
SHAHUKARI CHETAN
LAB TASK - 2
FALL Semester 2021-22
19BEC0858
SHAHUKARI CHETAN
FACULTY NAME : PROF. MALAYA KUMAR HOTA
SLOT : L45+L46
19BEC0858
SHAHUKARI CHETAN
i)
Objective:
To Reading an audio and adding noise and filtering it using moving average
filter.
Procedure:-
▪ Reading an audio signal of format .wav from the user
▪ Adding noise to that signal of its length
▪ Producing the mixed signal and plotting the signals.
▪ Using moving average filter removing the noise from the mixed signal
using commands b = (1/size)*ones(1,size); output = filter(b,1,d); and
also plotting the removed noise signal. Here size determines the extend
of filtering.
▪ And we used get the noise removal signal at the output.
Code:-
clc;
clear all;
close all;
[signal,fs]=audioread('chetan.wa
v');
signal=signal(:,1);
%sound(signal,fs) %signal sound
length(signal)
noise=0.1*randn(536474,1);
%sound(noise,fs) %noise sound
d=signal+noise;
%sound(d,fs)%signal with noise
subplot(4,1,1);
plot(signal);
19BEC0858
SHAHUKARI CHETAN
title('sound signal(19BEC0858)')
subplot(4,1,2);
plot(noise);
title('noise(19BEC0858)')
subplot(4,1,3)
plot(d);
title('sound signal with noise(19BEC0858)')
size =10;
b = (1/size)*ones(1,size);
output = filter(b,1,d);
%sound(out,fs)
subplot(4,1,4);
plot(output)
title('filtered sound signal(19BEC0858)')
19BEC0858
SHAHUKARI CHETAN
Output:
Interface:-
Read an audio signal add random noise to get the noisy signal. Use moving
average filter to remove the noise from the contaminated audio signal
ii)
Objective:
Using MATLAB write a code for cross correlation of two signals without using
inbuilt function xcorr and after performing, to cross verify the result using xcorr.
Procedure:-
1. Input the two sequences respectively.
2. Arrange the 1st signal as it is in a column form.1st signal will now work as the
first column.
3. Then flip the 2nd sequence and arrange it in a row form.
4. Multiply the corresponding elements of the 1st row and 1st column to get the
values of the cells of the table.
5. Take the sum of the table value diagonally such that we get n1+n2-1 elements,
starting with R[1]C[1] as the 1st element, R[2]C[1]+R[1]C[2] as the 2nd, and
so on, where n1 and n2 are the number of elements in the 1st and the 2nd
sequence respectively. Sum must be done diagonally strictly.
6. Output sequence obtained is the correlation between the initial two sequences.
7. Finally cross check the answer using inbuilt function xcorr().
19BEC0858
SHAHUKARI CHETAN
Code:-
clc;
clear all;
% 19BEC0858 Shahukari Chetan
X=input('Enter X: ');
L1=input('Enter lower limit: ');
U1=input('Enter upper limit: ');
X1=L1:1:U1;
Y=input('Enter Y: ');
L2=input('Enter lower limit: ');
U2=input('Enter upper limit: ');
Y1=L2:1:U2;
Z=fliplr(Y);
L3=-U2;
U3=-L2;
Y2=L3:1:U3;
L=L1+L3;
U=U1+U3;
A=L:1:U;
a=length(X);
b=length(Z);
x=[X,zeros(1,b)];
subplot(311)
disp('x(n): ')
disp(X)
stem(X1,X)
xlabel('n')
ylabel('x(n)')
title('1st Sequence 19BEC0858')
grid on
y=[Y,zeros(1,a)];
z=[Z,zeros(1,a)];
subplot(312)
disp('z(n): ')
disp(Z)
stem(Y2,Z)
xlabel('n')
ylabel('z(n)')
title('2nd Folded Sequence
19BEC0858')
grid on;
19BEC0858
SHAHUKARI CHETAN
for i=1:b+a-1
A1(i)=0;
for j=1:a
if((i-j+1)>0)
A1(i)=A1(i)+(X(j)*z(i-j+1));
else
end
end
end
subplot(313)
disp('y(n): ')
disp(A1)
stem(A,A1)
xlabel('n')
ylabel('y(n)')
title('Output Sequence')
grid on;
xcorr(X,Y)
19BEC0858
SHAHUKARI CHETAN
Manual Calculation:-
Experimental Result :-
19BEC0858
SHAHUKARI CHETAN
Result/Inference:
We ploted the cross correlation and verified it successfully
Output:
iii)
Objective:
To generate the Circular convolution between two sequences in time domain
without using any inbuilt function and cross verify the result using “cconv”.
Procedure:-
▪ Enter the two functions
▪ Find the length of the two function Use for loop to multiply the two function
and calculate the product.
clc;
clear all;
close all;
x=input('enter x:');
h=input('enter h:');
m=length(x);
n=length(h);
k=max(m,n);
a=1:k;
X=[x,zeros(1,k-m)];
Code:
19BEC0858
SHAHUKARI CHETAN
H=[h,zeros(1,k-n)];
Y=zeros(1,n);
for i=0:k-1
for j=0:k-1
q=mod((i-j),k);
Y(i+1)=Y(i+1)+X(j+1)*H(q+1);
end
end
Y
stem(a,Y)
title("circular convolution
signal(19BEC0858)")
%VERIFING BY IN-BUILD FUNCTION
cconv([1 5 3 3],[6 7 8 9],4)
Experimental Result :-
19BEC0858
SHAHUKARI CHETAN
Output:
RESULT:
To perform the circular convolution for the inputs that we are been given for the
two sequences
Manual Calculation:-

More Related Content

What's hot

Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Ehtisham Ali
 
Analysis of algorithn class 3
Analysis of algorithn class 3Analysis of algorithn class 3
Analysis of algorithn class 3
Kumar
 

What's hot (20)

Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
 
A star
A starA star
A star
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
 
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
 
Analysis of Electro-Mechanical System
Analysis of Electro-Mechanical SystemAnalysis of Electro-Mechanical System
Analysis of Electro-Mechanical System
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLABMathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpsk
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Analysis of algorithn class 3
Analysis of algorithn class 3Analysis of algorithn class 3
Analysis of algorithn class 3
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Reconstruction
ReconstructionReconstruction
Reconstruction
 
Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4
 
Ch01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluitonCh01 basic concepts_nosoluiton
Ch01 basic concepts_nosoluiton
 
A* (aster) Search Algorithm
A* (aster) Search AlgorithmA* (aster) Search Algorithm
A* (aster) Search Algorithm
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Control systems lab task
Control systems lab taskControl systems lab task
Control systems lab task
 

Similar to Dsp lab task 2

Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
Shankar Gangaju
 
ELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docx
ELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docxELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docx
ELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docx
toltonkendal
 
Matlab 3
Matlab 3Matlab 3
Matlab 3
asguna
 

Similar to Dsp lab task 2 (20)

DSP lab manual
DSP lab manualDSP lab manual
DSP lab manual
 
BS LAB Manual (1).pdf
BS LAB Manual  (1).pdfBS LAB Manual  (1).pdf
BS LAB Manual (1).pdf
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
 
13486500-FFT.ppt
13486500-FFT.ppt13486500-FFT.ppt
13486500-FFT.ppt
 
Computer Organization And Architecture lab manual
Computer Organization And Architecture lab manualComputer Organization And Architecture lab manual
Computer Organization And Architecture lab manual
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
digital signal-processing-lab-manual
digital signal-processing-lab-manualdigital signal-processing-lab-manual
digital signal-processing-lab-manual
 
Informe laboratorio n°1
Informe laboratorio n°1Informe laboratorio n°1
Informe laboratorio n°1
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
 
Dsp iit workshop
Dsp iit workshopDsp iit workshop
Dsp iit workshop
 
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
 
ELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docx
ELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docxELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docx
ELEG 320L – Signals & Systems Laboratory Dr. Jibran Khan Yous.docx
 
Matlab 3
Matlab 3Matlab 3
Matlab 3
 
Lecture Slide (21).pptx
Lecture Slide (21).pptxLecture Slide (21).pptx
Lecture Slide (21).pptx
 
Convolutional codes
Convolutional codesConvolutional codes
Convolutional codes
 
Chap08alg
Chap08algChap08alg
Chap08alg
 
Chap08alg
Chap08algChap08alg
Chap08alg
 
unit 5 (1).pptx
unit 5 (1).pptxunit 5 (1).pptx
unit 5 (1).pptx
 
Introduction to Data Science With R Lab Record
Introduction to Data Science With R Lab RecordIntroduction to Data Science With R Lab Record
Introduction to Data Science With R Lab Record
 
EC8553 Discrete time signal processing
EC8553 Discrete time signal processing EC8553 Discrete time signal processing
EC8553 Discrete time signal processing
 

More from ChetanShahukari (12)

Presentation1 copy (4)
Presentation1   copy (4)Presentation1   copy (4)
Presentation1 copy (4)
 
Presentation1 copy (3)
Presentation1   copy (3)Presentation1   copy (3)
Presentation1 copy (3)
 
Dsp review
Dsp reviewDsp review
Dsp review
 
Dsp review 1,2,3
Dsp review 1,2,3Dsp review 1,2,3
Dsp review 1,2,3
 
Urbanplanning cat1
Urbanplanning cat1Urbanplanning cat1
Urbanplanning cat1
 
Micro task1
Micro task1Micro task1
Micro task1
 
Presentation1
Presentation1Presentation1
Presentation1
 
19bec0855 project review 1-converted
19bec0855 project review 1-converted19bec0855 project review 1-converted
19bec0855 project review 1-converted
 
Iot vijaya priya r cat1
Iot vijaya priya r cat1Iot vijaya priya r cat1
Iot vijaya priya r cat1
 
Ppt 2
Ppt 2Ppt 2
Ppt 2
 
Presentation1 copy (2)
Presentation1   copy (2)Presentation1   copy (2)
Presentation1 copy (2)
 
Presentation1 copy
Presentation1   copyPresentation1   copy
Presentation1 copy
 

Recently uploaded

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (20)

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

Dsp lab task 2

  • 1. NAME : REG.NO : 19BEC0858 COURSE CODE : ECE2006 COURSE TITLE : DIGITAL SIGNAL PROCESSING SHAHUKARI CHETAN LAB TASK - 2 FALL Semester 2021-22 19BEC0858 SHAHUKARI CHETAN FACULTY NAME : PROF. MALAYA KUMAR HOTA SLOT : L45+L46
  • 2. 19BEC0858 SHAHUKARI CHETAN i) Objective: To Reading an audio and adding noise and filtering it using moving average filter. Procedure:- ▪ Reading an audio signal of format .wav from the user ▪ Adding noise to that signal of its length ▪ Producing the mixed signal and plotting the signals. ▪ Using moving average filter removing the noise from the mixed signal using commands b = (1/size)*ones(1,size); output = filter(b,1,d); and also plotting the removed noise signal. Here size determines the extend of filtering. ▪ And we used get the noise removal signal at the output. Code:- clc; clear all; close all; [signal,fs]=audioread('chetan.wa v'); signal=signal(:,1); %sound(signal,fs) %signal sound length(signal) noise=0.1*randn(536474,1); %sound(noise,fs) %noise sound d=signal+noise; %sound(d,fs)%signal with noise subplot(4,1,1); plot(signal);
  • 3. 19BEC0858 SHAHUKARI CHETAN title('sound signal(19BEC0858)') subplot(4,1,2); plot(noise); title('noise(19BEC0858)') subplot(4,1,3) plot(d); title('sound signal with noise(19BEC0858)') size =10; b = (1/size)*ones(1,size); output = filter(b,1,d); %sound(out,fs) subplot(4,1,4); plot(output) title('filtered sound signal(19BEC0858)')
  • 4. 19BEC0858 SHAHUKARI CHETAN Output: Interface:- Read an audio signal add random noise to get the noisy signal. Use moving average filter to remove the noise from the contaminated audio signal ii) Objective: Using MATLAB write a code for cross correlation of two signals without using inbuilt function xcorr and after performing, to cross verify the result using xcorr. Procedure:- 1. Input the two sequences respectively. 2. Arrange the 1st signal as it is in a column form.1st signal will now work as the first column. 3. Then flip the 2nd sequence and arrange it in a row form. 4. Multiply the corresponding elements of the 1st row and 1st column to get the values of the cells of the table. 5. Take the sum of the table value diagonally such that we get n1+n2-1 elements, starting with R[1]C[1] as the 1st element, R[2]C[1]+R[1]C[2] as the 2nd, and so on, where n1 and n2 are the number of elements in the 1st and the 2nd sequence respectively. Sum must be done diagonally strictly. 6. Output sequence obtained is the correlation between the initial two sequences. 7. Finally cross check the answer using inbuilt function xcorr().
  • 5. 19BEC0858 SHAHUKARI CHETAN Code:- clc; clear all; % 19BEC0858 Shahukari Chetan X=input('Enter X: '); L1=input('Enter lower limit: '); U1=input('Enter upper limit: '); X1=L1:1:U1; Y=input('Enter Y: '); L2=input('Enter lower limit: '); U2=input('Enter upper limit: '); Y1=L2:1:U2; Z=fliplr(Y); L3=-U2; U3=-L2; Y2=L3:1:U3; L=L1+L3; U=U1+U3; A=L:1:U; a=length(X); b=length(Z); x=[X,zeros(1,b)]; subplot(311) disp('x(n): ') disp(X) stem(X1,X) xlabel('n') ylabel('x(n)') title('1st Sequence 19BEC0858') grid on y=[Y,zeros(1,a)]; z=[Z,zeros(1,a)]; subplot(312) disp('z(n): ') disp(Z) stem(Y2,Z) xlabel('n') ylabel('z(n)') title('2nd Folded Sequence 19BEC0858') grid on;
  • 6. 19BEC0858 SHAHUKARI CHETAN for i=1:b+a-1 A1(i)=0; for j=1:a if((i-j+1)>0) A1(i)=A1(i)+(X(j)*z(i-j+1)); else end end end subplot(313) disp('y(n): ') disp(A1) stem(A,A1) xlabel('n') ylabel('y(n)') title('Output Sequence') grid on; xcorr(X,Y)
  • 8. 19BEC0858 SHAHUKARI CHETAN Result/Inference: We ploted the cross correlation and verified it successfully Output: iii) Objective: To generate the Circular convolution between two sequences in time domain without using any inbuilt function and cross verify the result using “cconv”. Procedure:- ▪ Enter the two functions ▪ Find the length of the two function Use for loop to multiply the two function and calculate the product. clc; clear all; close all; x=input('enter x:'); h=input('enter h:'); m=length(x); n=length(h); k=max(m,n); a=1:k; X=[x,zeros(1,k-m)]; Code:
  • 9. 19BEC0858 SHAHUKARI CHETAN H=[h,zeros(1,k-n)]; Y=zeros(1,n); for i=0:k-1 for j=0:k-1 q=mod((i-j),k); Y(i+1)=Y(i+1)+X(j+1)*H(q+1); end end Y stem(a,Y) title("circular convolution signal(19BEC0858)") %VERIFING BY IN-BUILD FUNCTION cconv([1 5 3 3],[6 7 8 9],4) Experimental Result :-
  • 10. 19BEC0858 SHAHUKARI CHETAN Output: RESULT: To perform the circular convolution for the inputs that we are been given for the two sequences Manual Calculation:-