The purpose of this simple project is to give students a chance to review what we have covered in the class and to get familiar with signal processing techniques. All the problems have to be coded by MATLAB and to be submitted with printed outputs. This section is designed to illustrate the two basic principles of the sampling process: aliasing and reconstruction. To show the aliasing effect we need a simple analog input signal to run through the system. We will use sinusoids. To get started, you must pick a analog frequency: take this to bcF-80 kHz. Generate a analog signal that is a cosine wave with analog frequency F over time interval of length T. Take the phase to be random. Choose the signal length/\'so that you get about 900 to 1000 samples of the analog signal. Plot the time signal with plot. Make sure that you label the time axis with the true analog time. Plot the Fourier transform of this signal (see attached) The A,D converter takes samples spaced by 7x. To avoid unnecessary complications, the ratio of F to the sampling rate F, should be an integer l. Then every lth sample of the s(t) vector can be selected lor the A/D conversion. Plot the resulting discrete-time signal when F, 8 kHz. Compute the discrete Fourier transform (sec DFT.m attached) of the discrete-time signal and explain how it is related to the Fourier transform of the analog signal in 1(c).
%Program to generate Exponential Fouries series of a periodic Fullwave rectified signal
clc;close all;clear all;
t=-3*pi:0.001:3*pi;
% periodic rectangular pulse
A=20;
w=1;
y=A*sin(w*t);
figure; plot(t,abs(y));
title(\'signal\')
% number of harmonics in the series
N=25;
%generate fourier coefficients and basis functions
for i=1:N
%y1(0)=2*A/pi;
cp(i)=2*A/(pi*(1-4*(i-1)^2));
cn(i)=2*A/(pi*(1-4*(-i)^2));
cn1=fliplr(cn);
y2(i,:)=cp(i)*(exp(j*2*w*(i-1)*t));
y3(i,:)=cn(i)*(exp(-j*2*w*(i)*t));
end
%plotting of Discrete fourier spectrum
figure;stem([-N:N-1],[cn1,cp]);
title(\'Discrete fourier spectrum Cn\')
% reconstruction of the signal from coefficients
y4(1,:)=sum(y2)+sum(y3);
figure;plot(t,y4)
title(\'reconstructed rectangular signal from coefficients\')
%
% Fourier transform of a signal
clc;close all;clear all;
syms t w
% input signal x(t)
x=exp(-2*t).*heaviside(t);
subplot(3,1,1);ezplot(x);
title(\'input signal\')
% fourier transform
disp(\'the fourier transform of x(t) is\')
X=fourier(x); X=simplify(X);
% frequency response
subplot(3,1,2);ezplot(abs(X));
title(\'Magnitude response of Fourier transform \')
subplot(3,1,3);ezplot(atan((imag(X))/(real(X))))
title(\'phase response of Fourier transform \')