Sabtu, 14 Januari 2012

Convolution of sinusoidal and rectangular signal- Guassian signal?

What happens when a sinusoidal signal is convolved with a rectangular signal? This is a similar question that comes into mind when a voice signal is modulated with rectangular pulses as in case of digital modulation. Voice signal is essentially made of many sinusoid with varying amplitude. In engineering mathematics we take a sinusoid signal as a test signal to make calculation. Also convolution is essentially modulation that comes into play in Linear Time Invariant system study.

Lets take a look what kind of waveform we get when we convolve sine signal and a rectangular signal in Matlab.

First let us generate a simple sinusoid signal (sine or cosine doesn't matter here really) in matlab-

t = -10:0.01:10;
x = cos(t);
subplot(3,1,1);
plot(t,x);
axis([-10 10 -2 2]);
xlabel('time');
ylabel('sine');
%grid on

It's not hard to figure out what the code means( I hope).

Then we similarly generate a rectangular signal-

w = pi/2;
s = 2*pi;
d = -10:s:10;
h = pulstran(t,d,'rectpuls',w);
subplot(3,1,2);
plot(t,h);
axis([-10 10 -2 2]);
xlabel('time');
ylabel('rect');

You can customize the x, y label and add title if you wish.

Now comes the convolution part. Matlab has inbuild function called conv(a,b) where a and b are the signals to be convolved.

The code below is our code for convoluting the two signal above-

%Convolution y = x @ h

y = conv(x,h);
t1 = -20:0.01:20;
subplot(3,1,3);
plot(t1,y);
axis([-50 50 -550 550]);
xlabel('time');
ylabel('conv');
%grid on;

Notice that the time frame is changed to a larger length and also the axis settings has been changed to accommodate the resulting signal amplitude.

Then the output waveform graph is shown below-

convolution of sinusoidal and rectangular signal
Fig: convolution of sinusoidal and rectangular signal
The bottom is the waveform at the output. This waveform is interesting since it resembles a Gaussian pulse waveform. It has such a nice waveform look. Take a closer look-


The entire matlab code is below-

%Matlab Code to perform convolution between sinusoidal and rectangular
%signal
% http://electronic2017.blogspot.com

% Sinusoid signal

t = -10:0.01:10;
x = cos(t);
subplot(3,1,1);
plot(t,x);
axis([-10 10 -2 2]);
xlabel('time');
ylabel('sine');
%grid on

%Rectangular signal

w = pi/2;
s = 2*pi;
d = -10:s:10;
h = pulstran(t,d,'rectpuls',w);
subplot(3,1,2);
plot(t,h);
axis([-10 10 -2 2]);
xlabel('time');
ylabel('rect');
%grid on

%Convolution y = x @ h

y = conv(x,h);
t1 = -20:0.01:20;
subplot(3,1,3);
plot(t1,y);
axis([-50 50 -550 550]);
xlabel('time');
ylabel('conv');
%grid on;

Tidak ada komentar:

Posting Komentar