Asked by umar
on 17 Dec 2011

Write a MATLAB routine that generally computes the discrete convolution between two discrete signals in time-domain. (Do not use the standard MATLAB “conv” function.) • Apply your routine to compute the convolution rect( t / 4 )*rect( 2 t / 3 ).

*No products are associated with this question.*

Answer by Naz
on 17 Dec 2011

just implement the equation http://en.wikipedia.org/wiki/Convolution#Circular_discrete_convolution and use sum from 1 to N instead of 0 to N-1

Wayne King
on 17 Dec 2011

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 1 Comment

## umar (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/24184#comment_53099

If i use below coding, how to put rect(t/4) and rect(2t/3)in x and h? Please can anyone answer this?

% A GENERALAZED CONVOLUTION COMPUTING CODE IN MATLAB WITHOUT USING MATLAB BUILTIN FUNCTION conv(x,h)

close all

clear all

x=input('Enter x: ')

h=input('Enter h: ')

m=length(x);

n=length(h);

X=[x,zeros(1,n)];

H=[h,zeros(1,m)];

for i=1:n+m-1

Y(i)=0;

for j=1:m

if(i-j+1>0)

Y(i)=Y(i)+X(j)*H(i-j+1);

else

end

end

end

Y

stem(Y);

ylabel('Y[n]');

xlabel('----->n');

title('Convolution of Two Signals without conv function');