SlideShare a Scribd company logo
x=input('Enter the first sequence: ');
l1=input('Enter the lower limit: ');
u1=input('Enter the upper limit: ');
x1=l1:1:u1;
h=input('Enter the second sequence: ');
l2=input('Enter the lower limit: ');
u2=input('Enter the upper limit: ');
h1=l2:1:u2;
l=l1+l2;
u=u1+u2;
n=l:1:u;
s=numel(n);
i=1;
for i=1:s
y(i)=0;
for k=1:numel(x)
if (i+1-k)<=0
y(i)=y(i)+(x(k)*0);
else if (i+1-k)>numel(h)
y(i)=y(i)+(x(k)*0);
else
y(i)=y(i)+(x(k)*h(i+1-k));
k=k+1;
end
end
end
i=i+1;
end
disp(y);
subplot(2,2,1);stem(x1,x);
title('First sequence');xlabel('n');ylabel('x(n)');
subplot(2,2,2);stem(h1,h);
title('Second Sequence');xlabel('n');ylabel('h(n)');
subplot(2,2,[3 4]);stem(n,y);
title('Convoluted sequence');xlabel('n');ylabel('y(n)');
Comment only
X = input('Enter x: '); %input vector X and H
H = input('Enter h: ') ;
LenX = length(X); %defining their lenghts
LenH = length(H);
y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size
% lenth of X + length of H
t = zeros(1,LenH); % definign a vector t of same length as H
for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1
if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin
t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1)
for j = 1:LenH % in the if condition a for loop from 1 to length of H
y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first
iteration
% i.e. for i=1 only firt multiplication would
% be non zero rest all zeroes.
end
for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values
in t
% this cycle would continue until i is lesser then
% length X i.e. overlap increasing every iteration less
% and less non zero vales in t every iteration
t(k) = t(k-1);
end
else % now when all of the T is non zero which means 100% overlap in else overlap would start
to decrease between T and H
% T is basically X
t(1)= 0;
for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and
each iteration it would decrease
% i.e T moving to left until there is no more
% over lap
y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add the
% putting it at y(1) or y(2) or Y(i) in first iteration
end
for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales of
x
%now we are filling up zeroos in t i.e. over lap decreasing
t(k) = t(k-1);
end
end
end
ly=length(y)
indices=[ly]
for i=1:ly
indices(i)=i;
end
disp (y); %displays vector y.
disp (indices); % displays vector indices.
stem(y);
ylabel('Y[n]');
xlabel('[n]');
title('Convolution without conv function');
x=input('Enter the first sequence: ');
l1=input('Enter the lower limit: ');
u1=input('Enter the upper limit: ');
x1=l1:1:u1;
h=input('Enter the second sequence: ');
l2=input('Enter the lower limit: ');
u2=input('Enter the upper limit: ');
h1=l2:1:u2;
l=l1+l2;
u=u1+u2;
n=l:1:u;
s=numel(n);
i=1;
for i=1:s
y(i)=0;
for k=1:numel(x)
if (i+1-k)<=0
y(i)=y(i)+(x(k)*0);
else if (i+1-k)>numel(h)
y(i)=y(i)+(x(k)*0);
else
y(i)=y(i)+(x(k)*h(i+1-k));
k=k+1;
end
end
end
i=i+1;
end
disp(y);
subplot(2,2,1);stem(x1,x);
title('First sequence');xlabel('n');ylabel('x(n)');
subplot(2,2,2);stem(h1,h);
title('Second Sequence');xlabel('n');ylabel('h(n)');
subplot(2,2,[3 4]);stem(n,y);
title('Convoluted sequence');xlabel('n');ylabel('y(n)');
Comment only28 Jan 2014assad
X = input('Enter x: '); %input vector X and H
H = input('Enter h: ') ;
LenX = length(X); %defining their lenghts
LenH = length(H);
y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size
% lenth of X + length of H
t = zeros(1,LenH); % definign a vector t of same length as H
for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1
if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin
t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1)
for j = 1:LenH % in the if condition a for loop from 1 to length of H
y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first
iteration
% i.e. for i=1 only firt multiplication would
% be non zero rest all zeroes.
end
for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values
in t
% this cycle would continue until i is lesser then
% length X i.e. overlap increasing every iteration less
% and less non zero vales in t every iteration
t(k) = t(k-1);
end
else % now when all of the T is non zero which means 100% overlap in else overlap would start
to decrease between T and H
% T is basically X
t(1)= 0;
for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and
each iteration it would decrease
% i.e T moving to left until there is no more
% over lap
y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add
the
% putting it at y(1) or y(2) or Y(i) in first iteration
end
for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales
of x
%now we are filling up zeroos in t i.e. over lap decreasing
t(k) = t(k-1);
end
end
end
ly=length(y)
indices=[ly]
for i=1:ly
indices(i)=i;
end
disp (y); %displays vector y.
disp (indices); % displays vector indices.
stem(y);
ylabel('Y[n]');
xlabel('[n]');
title('Convolution without conv function');
Solution
x=input('Enter the first sequence: ');
l1=input('Enter the lower limit: ');
u1=input('Enter the upper limit: ');
x1=l1:1:u1;
h=input('Enter the second sequence: ');
l2=input('Enter the lower limit: ');
u2=input('Enter the upper limit: ');
h1=l2:1:u2;
l=l1+l2;
u=u1+u2;
n=l:1:u;
s=numel(n);
i=1;
for i=1:s
y(i)=0;
for k=1:numel(x)
if (i+1-k)<=0
y(i)=y(i)+(x(k)*0);
else if (i+1-k)>numel(h)
y(i)=y(i)+(x(k)*0);
else
y(i)=y(i)+(x(k)*h(i+1-k));
k=k+1;
end
end
end
i=i+1;
end
disp(y);
subplot(2,2,1);stem(x1,x);
title('First sequence');xlabel('n');ylabel('x(n)');
subplot(2,2,2);stem(h1,h);
title('Second Sequence');xlabel('n');ylabel('h(n)');
subplot(2,2,[3 4]);stem(n,y);
title('Convoluted sequence');xlabel('n');ylabel('y(n)');
Comment only
X = input('Enter x: '); %input vector X and H
H = input('Enter h: ') ;
LenX = length(X); %defining their lenghts
LenH = length(H);
y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size
% lenth of X + length of H
t = zeros(1,LenH); % definign a vector t of same length as H
for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1
if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin
t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1)
for j = 1:LenH % in the if condition a for loop from 1 to length of H
y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first
iteration
% i.e. for i=1 only firt multiplication would
% be non zero rest all zeroes.
end
for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values
in t
% this cycle would continue until i is lesser then
% length X i.e. overlap increasing every iteration less
% and less non zero vales in t every iteration
t(k) = t(k-1);
end
else % now when all of the T is non zero which means 100% overlap in else overlap would start
to decrease between T and H
% T is basically X
t(1)= 0;
for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and
each iteration it would decrease
% i.e T moving to left until there is no more
% over lap
y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add the
% putting it at y(1) or y(2) or Y(i) in first iteration
end
for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales of
x
%now we are filling up zeroos in t i.e. over lap decreasing
t(k) = t(k-1);
end
end
end
ly=length(y)
indices=[ly]
for i=1:ly
indices(i)=i;
end
disp (y); %displays vector y.
disp (indices); % displays vector indices.
stem(y);
ylabel('Y[n]');
xlabel('[n]');
title('Convolution without conv function');
x=input('Enter the first sequence: ');
l1=input('Enter the lower limit: ');
u1=input('Enter the upper limit: ');
x1=l1:1:u1;
h=input('Enter the second sequence: ');
l2=input('Enter the lower limit: ');
u2=input('Enter the upper limit: ');
h1=l2:1:u2;
l=l1+l2;
u=u1+u2;
n=l:1:u;
s=numel(n);
i=1;
for i=1:s
y(i)=0;
for k=1:numel(x)
if (i+1-k)<=0
y(i)=y(i)+(x(k)*0);
else if (i+1-k)>numel(h)
y(i)=y(i)+(x(k)*0);
else
y(i)=y(i)+(x(k)*h(i+1-k));
k=k+1;
end
end
end
i=i+1;
end
disp(y);
subplot(2,2,1);stem(x1,x);
title('First sequence');xlabel('n');ylabel('x(n)');
subplot(2,2,2);stem(h1,h);
title('Second Sequence');xlabel('n');ylabel('h(n)');
subplot(2,2,[3 4]);stem(n,y);
title('Convoluted sequence');xlabel('n');ylabel('y(n)');
Comment only28 Jan 2014assad
X = input('Enter x: '); %input vector X and H
H = input('Enter h: ') ;
LenX = length(X); %defining their lenghts
LenH = length(H);
y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size
% lenth of X + length of H
t = zeros(1,LenH); % definign a vector t of same length as H
for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1
if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin
t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1)
for j = 1:LenH % in the if condition a for loop from 1 to length of H
y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first
iteration
% i.e. for i=1 only firt multiplication would
% be non zero rest all zeroes.
end
for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values
in t
% this cycle would continue until i is lesser then
% length X i.e. overlap increasing every iteration less
% and less non zero vales in t every iteration
t(k) = t(k-1);
end
else % now when all of the T is non zero which means 100% overlap in else overlap would start
to decrease between T and H
% T is basically X
t(1)= 0;
for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and
each iteration it would decrease
% i.e T moving to left until there is no more
% over lap
y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add
the
% putting it at y(1) or y(2) or Y(i) in first iteration
end
for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales
of x
%now we are filling up zeroos in t i.e. over lap decreasing
t(k) = t(k-1);
end
end
end
ly=length(y)
indices=[ly]
for i=1:ly
indices(i)=i;
end
disp (y); %displays vector y.
disp (indices); % displays vector indices.
stem(y);
ylabel('Y[n]');
xlabel('[n]');
title('Convolution without conv function');

More Related Content

Similar to x=input(Enter the first sequence ); l1=input(Enter the lowe.pdf

A Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisA Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann Hypothesis
Charaf Ech-Chatbi
 
Lecture - 4.pdf
Lecture - 4.pdfLecture - 4.pdf
Lecture - 4.pdf
nath479500
 
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfUse the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
acteleshoppe
 
ode45 task.docx
ode45 task.docxode45 task.docx
ode45 task.docx
likeme123456
 
Linear transforamtion and it,s applications.(VCLA)
Linear transforamtion and it,s applications.(VCLA)Linear transforamtion and it,s applications.(VCLA)
Linear transforamtion and it,s applications.(VCLA)
DeepRaval7
 
This is testing Algorithm Writing For this assessment we will be c.pdf
This is testing Algorithm Writing For this assessment we will be c.pdfThis is testing Algorithm Writing For this assessment we will be c.pdf
This is testing Algorithm Writing For this assessment we will be c.pdf
aroraopticals15
 
linear transformation and rank nullity theorem
linear transformation and rank nullity theorem linear transformation and rank nullity theorem
linear transformation and rank nullity theorem
Manthan Chavda
 
3.2 Convolución gráfica de dos funciones
3.2 Convolución gráfica de dos funciones3.2 Convolución gráfica de dos funciones
3.2 Convolución gráfica de dos funciones
SantiagoSandoval65
 
Anomalous Transport
Anomalous TransportAnomalous Transport
Anomalous Transport
Subham Dutta Chowdhury
 
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docxMATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
andreecapon
 
Ma2002 1.19 rm
Ma2002 1.19 rmMa2002 1.19 rm
Ma2002 1.19 rm
Ramakrishna Paduchuri
 
NONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALES
NONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALESNONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALES
NONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALES
Tahia ZERIZER
 
Linear regression
Linear regressionLinear regression
Linear regression
Zoya Bylinskii
 
Cash Settled Interest Rate Swap Futures
Cash Settled Interest Rate Swap FuturesCash Settled Interest Rate Swap Futures
Cash Settled Interest Rate Swap Futures
Clarus Financial Technology
 

Similar to x=input(Enter the first sequence ); l1=input(Enter the lowe.pdf (20)

A Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisA Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann Hypothesis
 
Lecture - 4.pdf
Lecture - 4.pdfLecture - 4.pdf
Lecture - 4.pdf
 
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdfUse the same variable names and write the function F - Force(x-ks-kc-l.pdf
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
 
Lec9
Lec9Lec9
Lec9
 
ode45 task.docx
ode45 task.docxode45 task.docx
ode45 task.docx
 
Linear transforamtion and it,s applications.(VCLA)
Linear transforamtion and it,s applications.(VCLA)Linear transforamtion and it,s applications.(VCLA)
Linear transforamtion and it,s applications.(VCLA)
 
This is testing Algorithm Writing For this assessment we will be c.pdf
This is testing Algorithm Writing For this assessment we will be c.pdfThis is testing Algorithm Writing For this assessment we will be c.pdf
This is testing Algorithm Writing For this assessment we will be c.pdf
 
linear transformation and rank nullity theorem
linear transformation and rank nullity theorem linear transformation and rank nullity theorem
linear transformation and rank nullity theorem
 
Ma2002 1.14 rm
Ma2002 1.14 rmMa2002 1.14 rm
Ma2002 1.14 rm
 
3.2 Convolución gráfica de dos funciones
3.2 Convolución gráfica de dos funciones3.2 Convolución gráfica de dos funciones
3.2 Convolución gráfica de dos funciones
 
Taylor series
Taylor seriesTaylor series
Taylor series
 
Assignmnt 4
Assignmnt 4Assignmnt 4
Assignmnt 4
 
Anomalous Transport
Anomalous TransportAnomalous Transport
Anomalous Transport
 
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docxMATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
MATH 200-004 Multivariate Calculus Winter 2014Chapter 12.docx
 
Ma2002 1.19 rm
Ma2002 1.19 rmMa2002 1.19 rm
Ma2002 1.19 rm
 
NONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALES
NONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALESNONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALES
NONLINEAR DIFFERENCE EQUATIONS WITH SMALL PARAMETERS OF MULTIPLE SCALES
 
Fougeres Besancon Archimax
Fougeres Besancon ArchimaxFougeres Besancon Archimax
Fougeres Besancon Archimax
 
Ma2002 1.6 rm
Ma2002 1.6 rmMa2002 1.6 rm
Ma2002 1.6 rm
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Cash Settled Interest Rate Swap Futures
Cash Settled Interest Rate Swap FuturesCash Settled Interest Rate Swap Futures
Cash Settled Interest Rate Swap Futures
 

More from aquadreammail

A. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdfA. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdf
aquadreammail
 
10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf
aquadreammail
 
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
aquadreammail
 
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
aquadreammail
 
1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf
aquadreammail
 
Javac code for the manager of the Jeter County softball teamimp.pdf
 Javac code for the manager of the Jeter County softball teamimp.pdf Javac code for the manager of the Jeter County softball teamimp.pdf
Javac code for the manager of the Jeter County softball teamimp.pdf
aquadreammail
 
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
aquadreammail
 
the molecule is 2,2-dichloro-ethanol all carbons.pdf
                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf
the molecule is 2,2-dichloro-ethanol all carbons.pdf
aquadreammail
 
Increases. Gases have higher entropy than liquids.pdf
                     Increases. Gases have higher entropy than liquids.pdf                     Increases. Gases have higher entropy than liquids.pdf
Increases. Gases have higher entropy than liquids.pdf
aquadreammail
 
Simple C++ program to multiply two polynomials#include iostrea.pdf
 Simple C++ program to multiply two polynomials#include iostrea.pdf Simple C++ program to multiply two polynomials#include iostrea.pdf
Simple C++ program to multiply two polynomials#include iostrea.pdf
aquadreammail
 
design and deliver an confirmation based academic and instruction sy.pdf
  design and deliver an confirmation based academic and instruction sy.pdf  design and deliver an confirmation based academic and instruction sy.pdf
design and deliver an confirmation based academic and instruction sy.pdf
aquadreammail
 
OK, let me try to talk you through this. The arro.pdf
                     OK, let me try to talk you through this. The arro.pdf                     OK, let me try to talk you through this. The arro.pdf
OK, let me try to talk you through this. The arro.pdf
aquadreammail
 
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdfYes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
aquadreammail
 
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdfThe middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
aquadreammail
 
The link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdfThe link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdf
aquadreammail
 
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdfEPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
aquadreammail
 
The answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdfThe answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdf
aquadreammail
 
c. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdfc. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdf
aquadreammail
 
Text Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdfText Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdf
aquadreammail
 
SolutionPreparing the T-Accounts for the Above TransactionPrep.pdf
SolutionPreparing the T-Accounts for the Above TransactionPrep.pdfSolutionPreparing the T-Accounts for the Above TransactionPrep.pdf
SolutionPreparing the T-Accounts for the Above TransactionPrep.pdf
aquadreammail
 

More from aquadreammail (20)

A. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdfA. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdf
 
10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf
 
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
 
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
 
1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf
 
Javac code for the manager of the Jeter County softball teamimp.pdf
 Javac code for the manager of the Jeter County softball teamimp.pdf Javac code for the manager of the Jeter County softball teamimp.pdf
Javac code for the manager of the Jeter County softball teamimp.pdf
 
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
 
the molecule is 2,2-dichloro-ethanol all carbons.pdf
                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf
the molecule is 2,2-dichloro-ethanol all carbons.pdf
 
Increases. Gases have higher entropy than liquids.pdf
                     Increases. Gases have higher entropy than liquids.pdf                     Increases. Gases have higher entropy than liquids.pdf
Increases. Gases have higher entropy than liquids.pdf
 
Simple C++ program to multiply two polynomials#include iostrea.pdf
 Simple C++ program to multiply two polynomials#include iostrea.pdf Simple C++ program to multiply two polynomials#include iostrea.pdf
Simple C++ program to multiply two polynomials#include iostrea.pdf
 
design and deliver an confirmation based academic and instruction sy.pdf
  design and deliver an confirmation based academic and instruction sy.pdf  design and deliver an confirmation based academic and instruction sy.pdf
design and deliver an confirmation based academic and instruction sy.pdf
 
OK, let me try to talk you through this. The arro.pdf
                     OK, let me try to talk you through this. The arro.pdf                     OK, let me try to talk you through this. The arro.pdf
OK, let me try to talk you through this. The arro.pdf
 
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdfYes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
 
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdfThe middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
 
The link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdfThe link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdf
 
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdfEPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
 
The answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdfThe answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdf
 
c. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdfc. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdf
 
Text Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdfText Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdf
 
SolutionPreparing the T-Accounts for the Above TransactionPrep.pdf
SolutionPreparing the T-Accounts for the Above TransactionPrep.pdfSolutionPreparing the T-Accounts for the Above TransactionPrep.pdf
SolutionPreparing the T-Accounts for the Above TransactionPrep.pdf
 

Recently uploaded

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 

Recently uploaded (20)

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 

x=input(Enter the first sequence ); l1=input(Enter the lowe.pdf

  • 1. x=input('Enter the first sequence: '); l1=input('Enter the lower limit: '); u1=input('Enter the upper limit: '); x1=l1:1:u1; h=input('Enter the second sequence: '); l2=input('Enter the lower limit: '); u2=input('Enter the upper limit: '); h1=l2:1:u2; l=l1+l2; u=u1+u2; n=l:1:u; s=numel(n); i=1; for i=1:s y(i)=0; for k=1:numel(x) if (i+1-k)<=0 y(i)=y(i)+(x(k)*0); else if (i+1-k)>numel(h) y(i)=y(i)+(x(k)*0); else y(i)=y(i)+(x(k)*h(i+1-k)); k=k+1; end end end i=i+1; end disp(y); subplot(2,2,1);stem(x1,x); title('First sequence');xlabel('n');ylabel('x(n)'); subplot(2,2,2);stem(h1,h); title('Second Sequence');xlabel('n');ylabel('h(n)'); subplot(2,2,[3 4]);stem(n,y); title('Convoluted sequence');xlabel('n');ylabel('y(n)');
  • 2. Comment only X = input('Enter x: '); %input vector X and H H = input('Enter h: ') ; LenX = length(X); %defining their lenghts LenH = length(H); y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size % lenth of X + length of H t = zeros(1,LenH); % definign a vector t of same length as H for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1 if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1) for j = 1:LenH % in the if condition a for loop from 1 to length of H y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first iteration % i.e. for i=1 only firt multiplication would % be non zero rest all zeroes. end for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values in t % this cycle would continue until i is lesser then % length X i.e. overlap increasing every iteration less % and less non zero vales in t every iteration t(k) = t(k-1); end else % now when all of the T is non zero which means 100% overlap in else overlap would start to decrease between T and H % T is basically X t(1)= 0; for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and each iteration it would decrease % i.e T moving to left until there is no more % over lap y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add the % putting it at y(1) or y(2) or Y(i) in first iteration end for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales of
  • 3. x %now we are filling up zeroos in t i.e. over lap decreasing t(k) = t(k-1); end end end ly=length(y) indices=[ly] for i=1:ly indices(i)=i; end disp (y); %displays vector y. disp (indices); % displays vector indices. stem(y); ylabel('Y[n]'); xlabel('[n]'); title('Convolution without conv function'); x=input('Enter the first sequence: '); l1=input('Enter the lower limit: '); u1=input('Enter the upper limit: '); x1=l1:1:u1; h=input('Enter the second sequence: '); l2=input('Enter the lower limit: '); u2=input('Enter the upper limit: '); h1=l2:1:u2; l=l1+l2; u=u1+u2; n=l:1:u; s=numel(n); i=1; for i=1:s y(i)=0; for k=1:numel(x) if (i+1-k)<=0 y(i)=y(i)+(x(k)*0); else if (i+1-k)>numel(h)
  • 4. y(i)=y(i)+(x(k)*0); else y(i)=y(i)+(x(k)*h(i+1-k)); k=k+1; end end end i=i+1; end disp(y); subplot(2,2,1);stem(x1,x); title('First sequence');xlabel('n');ylabel('x(n)'); subplot(2,2,2);stem(h1,h); title('Second Sequence');xlabel('n');ylabel('h(n)'); subplot(2,2,[3 4]);stem(n,y); title('Convoluted sequence');xlabel('n');ylabel('y(n)'); Comment only28 Jan 2014assad X = input('Enter x: '); %input vector X and H H = input('Enter h: ') ; LenX = length(X); %defining their lenghts LenH = length(H); y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size % lenth of X + length of H t = zeros(1,LenH); % definign a vector t of same length as H for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1 if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1) for j = 1:LenH % in the if condition a for loop from 1 to length of H y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first iteration % i.e. for i=1 only firt multiplication would % be non zero rest all zeroes. end for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values in t % this cycle would continue until i is lesser then
  • 5. % length X i.e. overlap increasing every iteration less % and less non zero vales in t every iteration t(k) = t(k-1); end else % now when all of the T is non zero which means 100% overlap in else overlap would start to decrease between T and H % T is basically X t(1)= 0; for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and each iteration it would decrease % i.e T moving to left until there is no more % over lap y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add the % putting it at y(1) or y(2) or Y(i) in first iteration end for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales of x %now we are filling up zeroos in t i.e. over lap decreasing t(k) = t(k-1); end end end ly=length(y) indices=[ly] for i=1:ly indices(i)=i; end disp (y); %displays vector y. disp (indices); % displays vector indices. stem(y); ylabel('Y[n]'); xlabel('[n]'); title('Convolution without conv function'); Solution
  • 6. x=input('Enter the first sequence: '); l1=input('Enter the lower limit: '); u1=input('Enter the upper limit: '); x1=l1:1:u1; h=input('Enter the second sequence: '); l2=input('Enter the lower limit: '); u2=input('Enter the upper limit: '); h1=l2:1:u2; l=l1+l2; u=u1+u2; n=l:1:u; s=numel(n); i=1; for i=1:s y(i)=0; for k=1:numel(x) if (i+1-k)<=0 y(i)=y(i)+(x(k)*0); else if (i+1-k)>numel(h) y(i)=y(i)+(x(k)*0); else y(i)=y(i)+(x(k)*h(i+1-k)); k=k+1; end end end i=i+1; end disp(y); subplot(2,2,1);stem(x1,x); title('First sequence');xlabel('n');ylabel('x(n)'); subplot(2,2,2);stem(h1,h); title('Second Sequence');xlabel('n');ylabel('h(n)'); subplot(2,2,[3 4]);stem(n,y); title('Convoluted sequence');xlabel('n');ylabel('y(n)');
  • 7. Comment only X = input('Enter x: '); %input vector X and H H = input('Enter h: ') ; LenX = length(X); %defining their lenghts LenH = length(H); y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size % lenth of X + length of H t = zeros(1,LenH); % definign a vector t of same length as H for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1 if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1) for j = 1:LenH % in the if condition a for loop from 1 to length of H y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first iteration % i.e. for i=1 only firt multiplication would % be non zero rest all zeroes. end for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values in t % this cycle would continue until i is lesser then % length X i.e. overlap increasing every iteration less % and less non zero vales in t every iteration t(k) = t(k-1); end else % now when all of the T is non zero which means 100% overlap in else overlap would start to decrease between T and H % T is basically X t(1)= 0; for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and each iteration it would decrease % i.e T moving to left until there is no more % over lap y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add the % putting it at y(1) or y(2) or Y(i) in first iteration end for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales of
  • 8. x %now we are filling up zeroos in t i.e. over lap decreasing t(k) = t(k-1); end end end ly=length(y) indices=[ly] for i=1:ly indices(i)=i; end disp (y); %displays vector y. disp (indices); % displays vector indices. stem(y); ylabel('Y[n]'); xlabel('[n]'); title('Convolution without conv function'); x=input('Enter the first sequence: '); l1=input('Enter the lower limit: '); u1=input('Enter the upper limit: '); x1=l1:1:u1; h=input('Enter the second sequence: '); l2=input('Enter the lower limit: '); u2=input('Enter the upper limit: '); h1=l2:1:u2; l=l1+l2; u=u1+u2; n=l:1:u; s=numel(n); i=1; for i=1:s y(i)=0; for k=1:numel(x) if (i+1-k)<=0 y(i)=y(i)+(x(k)*0); else if (i+1-k)>numel(h)
  • 9. y(i)=y(i)+(x(k)*0); else y(i)=y(i)+(x(k)*h(i+1-k)); k=k+1; end end end i=i+1; end disp(y); subplot(2,2,1);stem(x1,x); title('First sequence');xlabel('n');ylabel('x(n)'); subplot(2,2,2);stem(h1,h); title('Second Sequence');xlabel('n');ylabel('h(n)'); subplot(2,2,[3 4]);stem(n,y); title('Convoluted sequence');xlabel('n');ylabel('y(n)'); Comment only28 Jan 2014assad X = input('Enter x: '); %input vector X and H H = input('Enter h: ') ; LenX = length(X); %defining their lenghts LenH = length(H); y = zeros(1,LenX+LenH); %defing vector y of zeroes and of size % lenth of X + length of H t = zeros(1,LenH); % definign a vector t of same length as H for i = 1:LenH+LenX-1 % Running a for loop from 1 to length of Y -1 if i<=LenX % till I IS Lesser then length of X i.e overlap about to begin t(1)= X(i); % put x(i) on t(1) later it is shifted forwards in the vector t i.e. later t(2)=t(1) for j = 1:LenH % in the if condition a for loop from 1 to length of H y(i) = y(i) + H(j)*t(j); % summing for all H(j)*t(j) and putting it at y(1) or y(2) or Y(i) in first iteration % i.e. for i=1 only firt multiplication would % be non zero rest all zeroes. end for k = LenH:-1:2 % shifting old value of t(i) to t(i+1) now there would me 1+ non zeroes values in t % this cycle would continue until i is lesser then
  • 10. % length X i.e. overlap increasing every iteration less % and less non zero vales in t every iteration t(k) = t(k-1); end else % now when all of the T is non zero which means 100% overlap in else overlap would start to decrease between T and H % T is basically X t(1)= 0; for j = 1:LenH % Now we start filling up Zeroes in T i.e. overlap began to decrease now and each iteration it would decrease % i.e T moving to left until there is no more % over lap y(i) = y(i) + (H(j)*t(j)); % in this for loop we multiply all respective vales of h and t and add the % putting it at y(1) or y(2) or Y(i) in first iteration end for k = LenH:-1:2 %% here just like similar loop above t where we were filling up t with vales of x %now we are filling up zeroos in t i.e. over lap decreasing t(k) = t(k-1); end end end ly=length(y) indices=[ly] for i=1:ly indices(i)=i; end disp (y); %displays vector y. disp (indices); % displays vector indices. stem(y); ylabel('Y[n]'); xlabel('[n]'); title('Convolution without conv function');