Explore BrainMass

Matlab Program to Computer

This content was STOLEN from BrainMass.com - View the original, and get the solution, here!

Hi. Please help me with this Matlab.

Write a matlab program to computer y(n)=h(n)*h(n) (convolution) without using the matlab convolution function 'conv'. That is, write matlab code to computer the convolution sum (... using nested loops?). Then use conv(h,x) to check the work.

Plot h, x, and y using the plot function.


This is what I have:

for n=-5:15,
for k=-100:100,

for z=-5:15,
disp (y(z+10));


The problem is that negative indices cannot be used - so I was trying to zero pad both sets. This seems to be okay, but for k being -infinity to +infinity and all, I'm stuck. I tried moving it to -100 to +100 but I get confused. I even tried drawing cells on a paper to visually see how to convolution is to be one, but I got even more confused.

Please correct the program so that it works. Thank you!

© BrainMass Inc. brainmass.com September 21, 2018, 6:15 pm ad1c9bdddf - https://brainmass.com/engineering/computer-engineering/25170

Solution Preview

Convolution is the same operation as multiplying the polynomials whose coefficients are the elements of u and v. DefinitionLet m = length(u) and n = length(v). Then w is the vector of length m+n-1 ...

Solution Summary

The solution is given with explanation.