0% found this document useful (0 votes)
9 views6 pages

Signal Processing Assignment1

The document defines parameters for generating a sinusoidal signal with 3 frequencies and adding noise. It generates the signals, saves the data in an Excel file, and plots the signals with and without noise to analyze the impact of noise on the signal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Signal Processing Assignment1

The document defines parameters for generating a sinusoidal signal with 3 frequencies and adding noise. It generates the signals, saves the data in an Excel file, and plots the signals with and without noise to analyze the impact of noise on the signal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment 1: Signal

Processing Using Matlab

Table of Contents
General Information ............................................................................................................................. 1
Clean Up ........................................................................................................................................... 1
Define Parameters ............................................................................................................................... 1
Saving the signals data in xlsx file ......................................................................................................... 2
Plotting The Signals ............................................................................................................................ 2

General Information
Author: Haider Hasan Hamood

Date Created: 19-2-2024

Context: ECE308, Computer Aided Communication Systems Design Lab

Objective: We want to generate a sinusoidal signal with 3 different frequencies and add noise to it and analyze the 2
signals using "Signal Analyzer" app to see the impact of the noise on the signal

Clean Up
clear;
clc;
close all;

Define Parameters
frequencies = [5 10 15]; % [Hz] the 3 frequencies for the signal
Fs = 500; % [Hz] The sampling frequency
Ts = 1/Fs; % [s] The sampling time

time_interval_1 = 0:Ts:2; % [s] Time interval 1, corresponds to f = 5 Hz


time_interval_2 = 2:Ts:4; % [s] Time interval 2, corresponds to f = 10 Hz
time_interval_3 = 4:Ts:6; % [s] Time interval 3, corresponds to f = 15 Hz
t = [time_interval_1 time_interval_2 time_interval_3]; % [s] time intervals
grouped in one vector

sig_no_noise1 = sin(2*pi*frequencies(1)*time_interval_1); % [mW] first part of


the signal (with f = 5 Hz)
sig_no_noise2 = sin(2*pi*frequencies(2)*time_interval_2); % [mW] second part
of the signal (with f = 10 Hz)

1
Assignment 1: Signal Pro-
cessing Using Matlab

sig_no_noise3 = sin(2*pi*frequencies(3)*time_interval_3); % [mW] third part of


the signal (with f = 15 Hz)
signal_no_noise = [sig_no_noise1 sig_no_noise2 sig_no_noise3]; % [mW] the 3
parts of the signal grouped in one vector

noise = 0.1*randn(size(t)); % the noise to be added to the signal


signal_with_noise = signal_no_noise + noise; % [mW] the signal with noise
added

% Extra (adding noise using awgn function)

SNR = 15; % [dB] Let the Signal-to-Noise Ratio arbitrarily be 15 dB


signal_with_awgn = awgn(signal_no_noise, SNR);

Saving the signals data in xlsx file


file_name = 'Signals_data.xlsx';
signals_data = [signal_no_noise ; signal_with_noise ; signal_with_awgn];
xlswrite(file_name, signals_data);

Plotting The Signals


% Plotting the signal with no noise...

subplot(3, 1, 1);
plot(t, signal_no_noise);
xlim([0 6]); ylim([-1.5 1.5]);
ylabel('Power [mW]'); xlabel('time [s]');
title('The Signal (No Noise)');
grid on;

% Plotting the signal with noise added (using randn function)...

subplot(3, 1, 2);
plot(t, signal_with_noise);
xlim([0 6]); ylim([-1.5 1.5]);
ylabel('Power [mW]'); xlabel('time [s]');
title('The Signal (with Noise)');
grid on;

% Plotting the signal with noise added (using awgn function)

subplot(3, 1, 3);
plot(t, signal_with_awgn);
xlim([0 6]); ylim([-1.5 1.5]);
ylabel('Power [mW]'); xlabel('time [s]');
title('The Signal (with AWGN)');
grid on;

2
Assignment 1: Signal Pro-
cessing Using Matlab

Published with MATLAB® R2023a

3
University of Kufa 19th – Feb – 2024

Assignment 1: Signal
Processing Using Matlab
Haider Hasan Hamood // 3rd Stage -Morning Study-
ECE // University of Kufa

Signal Analyzer Results

Fig. 1: Signals to be analyzed

5 Hz 10 Hz 15 Hz

Fig. 2: The Signal in time and frequency domain (Without Noise)

Page | 1 Computer Aided Comm. Systems Design


University of Kufa 19th – Feb – 2024

5 Hz 10 Hz 15 Hz

Fig. 3: The Signal in time and frequency domain (With Noise)

5 Hz 10 Hz 15 Hz

Fig. 4: The Signal in time and frequency domain (With Noise and Without Noise)

Page | 2 Computer Aided Comm. Systems Design


University of Kufa 19th – Feb – 2024

Discussion
From the power spectrum (frequency domain) in Fig. 2, we can see that the high power
components of the signal is at 5, 10, and 15 Hz (see red circles) which represents the frequency
values of the sinusoidal signal, after 15 Hz, the power starts to drop to very low values (below -
80 dB) because the signal doesn’t have frequency components after the highest frequency (15
Hz), but if we look at the signal in Fig. 3, we notice that the signal is distorted with white noise.
Even though the power is still concentrated at the 3 main frequency values (see red circles), the
white noise added to the signal results in power presented in frequencies higher than 15 Hz (see
the power spectrum), and since the power of the noise isn’t high, the power in higher frequencies
is still low (in the range of -50dB).
Fig. 4 clarifies the difference between the pure sinusoidal signal and the distorted signal even
further.

Page | 3 Computer Aided Comm. Systems Design

You might also like