Professional Documents
Culture Documents
Experiment No. 5: 1 Signal 2 Signal
Experiment No. 5: 1 Signal 2 Signal
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).
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