You are on page 1of 6

TEL252E SIGNAL & SYSTEMS TERM PROJECT

Generate the following signal

) where k = 0, 0.5

and 2 f0=100 Hz, f1=700 Hz


a) Determine sampling frequency and sampling time
b) Plot the signal in time domain and show its spectrum
c) Compute the frequency resolution
Repeat the computations for different noise levels by using the parameter k and Interpret the
results.

Results:
a) Calculating of Sampling Frequency and Sampling Time:
According to Nyquist Rate, which is 2f0, we determine sampling frequency.
Sampling frequency (fs) should be greater than 2f0. We know that knowledge from the
theorem of sampling principle.
fmax = f1
So fmax is 700 Hz.
Nyquist Rate is 2f0.
According to Nyquist Rate sampling frequency fs>2f0
2f0=1400 Hz.
We choose sampling frequency as 5000 Hz.
We choose number of data points as 1024.
Fs=5000 Hz
Fs is sampling frequency
Ts=1/ Fs =0.0002 s
Ts=0.2 ms
Ts is sampling time
Sampling Frequency & Sampling Time
Sampling Frequency

5000 Hz

Sampling Time

0.0002 s

b) Plotting for k=0


Plotting of Signal in time domain

Spectrum of Signal

Plotting for k=0.5


Plotting of Signal in time domain

Spectrum of Noisy Signal

Plotting for k=2


Plotting of Signal in time domain

Spectrum of Noisy Signal

c) Frequency Resolution formula is


Fs is sampling frequency
N is number of the data points.
We choose N=512 and our sampling frequency is 5000 Hz.
Frequency Resolution =Fs/N
=5000/512
= 9.765625
We calculate the frequency resolution as 9.765625 Hz

Interpreting:
If we increase the noise level data, which is named as k, there may be fluctuation on the
signal. The source of fluctuation is noise. We test the fluctuation with the different k values
which are 0, 0.5 and 2. According to graphs it can be understood that increasing of k values
causes more fluctuation. If we use k=0 we will get regular signal graphs.
Number of the data point changes the frequency resolution. For getting higher frequency
resolution, number of the data point should be increased

MATLAB CODE OF SINGAL GENERATION


%*****SIGNAL GENERATION CODE******
clc;
clear;
N=512; % Number of the data point
k=input('Please enter a value (0, 0.5, 2) for noise
coefficient')
n=1
nfft=N/n;
fs=5000;
frequency_resolution=fs/N
t=0:1/fs:(N-1)/fs;
f0=100;
f1=7*f0;
a=2;
b=5;
x=a*sin(2*pi*f0*t)+b*cos(2*pi*f1*t)+k*randn(1,N)
% randn command creates a random noise
F=(fs/N)*(0:N-1/2)
figure(1)
plot(t,x)
title('Signal of x(t) in time domain');xlabel('Time
(second)'),ylabel('x(t)')
p=fft(x)
%[p,f]=psd(x,nfft,fs,blackman(nfft));
figure(2)
plot(F(1:N/2),abs(p(1:N/2)))
%plot(f,p)
%plot(p)
title('Amplitude Spectrum of x(t)'),xlabel('Frequency
(Hz)'),ylabel('|X(jw)|')
frequency_resolution=fs/N

You might also like