Register to reply

Matlab Code for Convolution ... is this right?

by user101
Tags: code, convolution, matlab
Share this thread:
user101
#1
Sep23-07, 07:00 PM
P: 208
1. The problem statement, all variables and given/known data

A DT system has the unit response h[n] = (0.2(1.3)^n)u[n]. You then input x[n] = sin(n*pi/2)u[n]. Find the convolution.

2. Relevant equations

None.

3. The attempt at a solution

>> n = 0:30;
>> h = 0.2*(1.3).^n;
>> x = sin(n*pi/2);
>> s = conv(h,x);

I left out u[n] because we know that u[n] = 1 whenever n >= 0 and 0 when n < 0. So, if I am correct, it is just multiplying the input by 1, if n >=0.

This should be right, just wanted to verify.
Phys.Org News Partner Science news on Phys.org
Suddenly, the sun is eerily quiet: Where did the sunspots go?
'Moral victories' might spare you from losing again
Mammoth and mastodon behavior was less roam, more stay at home
wildman
#2
Sep23-07, 10:38 PM
P: 252
Looks good to me. Just remember that the far end of the convolution sum will not be valid because you are truncating it at 30. What the algorthm does is insert zeros at the front and back of the signals. This is all right on the low end because the signals are zero anyway below zero, but it will cause invalid results at the high end. This can be fixed by simply making the signals longer than you need.
user101
#3
Sep23-07, 10:51 PM
P: 208
oh it didnt specify how far n should go, so i made it randoml from 0 to 30.


Register to reply

Related Discussions
MATLAB code help please... Math & Science Software 2
Matlab code Math & Science Software 0
Convolution ('Conv') in MATLAB... Math & Science Software 1
Convolution Code and Error Correcting Capability Electrical Engineering 2
Convolution Code and Error Correcting Capability General Math 0