answersLogoWhite

0


Best Answer

%the program is developed my Mohendra Roy

%Bioelectronics division, Department of ECE, Tezpur Central University, India,

a=input('Please Give The RANGE : ');

k=-a:+1:+a;

x=input('The input the x: ')

h=input('The input the h: ')

% x=[1 .5 .25]

% h=[1 .5 .25]

f=fliplr(h);

l1=length(x);

l2=length(h);

l3=l1+l2-1;

l4=l2-1;

y=zeros(1,l3);

for p=1:1:l3

p1=p+l4;

h2=zeros(1,l3);

h2([p:p1])=f;

l5=length(h2);

h1=zeros(1,l5);

h1([l2:l3])=x

c1=h1.*h2

c2=0;

for i=1:1:l3

c2=c2+c1([i]);

end

sum=c2

y([p])=sum

end

% temp1=length(x);

% temp2=length(h);

t=length(y);

t2=(t-1)/2;

v=-t2:1:t2;

subplot(3,1,1),stem(k,x,'*');

subplot(3,1,2),stem(k,h,'g*');

subplot(3,1,3),stem(v,y,'r*');

n=input('The lower limit of X axis is: ')

m=input('The Upper limit of X axis is: ')

o=input('The lower limit of Y axis is: ')

p=input('The Upper limit of Y axis is: ')

subplot(3,1,1),stem(k,x,'*');axis([n m o p]);grid on

subplot(3,1,2),stem(k,h,'g*');axis([n m o p]);grid on

subplot(3,1,3),stem(v,y,'r*');axis([n m o p]);grid on

% subplot(3,1,1);stem(x);

% subplot(3,1,2);stem(h);

% subplot(3,1,3);stem(y);

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Code for convolution function in matlab?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Code for circular convolution matlab?

Please check the help files of the matlab circular convolution . Matlab already has a readymade function for it.


How do you modulate in matlab without using matlab tools?

You would have to write your own code for a modulation (Matlab has a convolution function not in the tools), otherwise you can use its built in function in the signal processing toolbox.


Convolution in matlab using for loop?

There are a lot of convolution functions in matlab, mostly in the signal processing toolbox, so it depends on what you want to do. Matlab has extensive help files available online.


How do you implement awgn in MATLAB without using awgn function?

no way... use awgn function in matlab


Gram schmidt matlab code for orthonormalizing set of vectors?

gram schmidt matlab code


Matlab code of convolutional coding and viterbi algorithm?

matlab code for convolutional coding and BCH coding


Difference between linear and circular convolution?

circular convolution is used for periodic and finite signals while linear convolution is used for aperiodic and infinite signals. In linear convolution we convolved one signal with another signal where as in circular convolution the same convolution is done but in circular pattern ,depending upon the samples of the signal


Which is the function of matlab?

matlab stands for matrix laboratory.. the function of matlab to create different types of signal and observe them .and their are so many different functions of matlab like, simulink fuzzy logic,simply arithmetic ,GUI etc


What is the difference between continuous and discrete convolution?

A convolution is a function defined on two functions f(.) and g(.). If the domains of these functions are continuous so that the convolution can be defined using an integral then the convolution is said to be continuous. If, on the other hand, the domaisn of the functions are discrete then the convolution would be defined as a sum and would be said to be discrete. For more information please see the wikipedia article about convolutions.


Segmentation image by GA plus source code Matlab?

Dear My friend I am Diem my Email: buitrongdiem@gmail.com I am writing programming GA code matlab but I do not know association objective function and constraint condition Can you say for me method association it ? Thanh you ve re much!!!! Best Regard BuiDiem


C program for 2D convolution?

You can use ImageMagick library and use 'convolve' function.


What is the source code to calculate the mean square error in matlab?

Here is an example of MATLAB code to calculate the mean square error (MSE): function mse = calculateMSE(actual, predicted) diff = actual - predicted; squared_diff = diff.^2; mse = mean(squared_diff); end In this code, the actual and predicted inputs represent the actual and predicted values, respectively. The function calculateMSE subtracts the predicted values from the actual values, squares the differences, takes the average of the squared differences, and returns the MSE.