You are on page 1of 5

Experiment No.

Aim: Write a program to plot the convolution of two discrete signals(a


exponential signal and a impulse signal) without using conv( )
function.

1 signal

2 signal

CODE-

close all;
clear all;
t1=0:10;
h=ones(1,11);
figure(1);
stem(t1,h);
t2=0:10;
x=exp(t2);
b=length(x);
figure(2);
stem(t2,x);
a=length(h);
r=zeros(a+b-1);
for n=1:a+b-1
for k=1:a
if(n-k+1>0) && (n-k+1<1+b)
r(n)=r(n)+x(k).*h(n-k+1);
end
end
end
z=min(t2)+min(t1):max(t1)+max(t2);
figure(3);
stem(z,r);

OUTPUT

Experiment No. 6
Aim: Plot the signal as a function of time. Compute the Fourier
transform of the signal, and then compute the magnitude m and phase
p of the signal. y = fft(x); a = abs(y); b = angle(y);

Theory :
To represent any periodic signal x(t), Fourier developed an expression
called Fourier series. This is in terms of an infinite sum of sines and
cosines or exponentials. Fourier series uses orthoganality condition.
Fourier Series Representation of Continuous Time Periodic Signals
A signal is said to be periodic if it satisfies the condition x (t) = x (t + T)
or x (n) = x (n + N).

Where T = fundamental time period,


0= fundamental frequency = 2/T
There are two basic periodic signals:
x(t)=cos0tx(t)=cos0t (sinusoidal) &
x(t)=ej0tx(t)=ej0t (complex exponential)
These two signals are periodic with period T=2/0T=2/0.
A set of harmonically related complex exponentials can be represented
as {k(t)k(t)}
k(t)={ejk0t}={ejk(2T)t}wherek=01,2..n.....
(1)k(t)={ejk0t}={ejk(2T)t}wherek=01,2..n.....(1)
All these signals are periodic with period T

CODEclc;
clear all;
n=8;
x=[2,3,4,5,1,2,3,4];
y=fft(x,n);
a=abs(y);
b=phase(y);
m=1:8;
subplot(1,2,1);
plot(m,a);title('Magnitude');
subplot(1,2,2);
plot(m,b);title('Phase');

OUTPUT

You might also like