Sei sulla pagina 1di 3

CEN320: Signals and Systems

Introduction to Signals and Signal Operations

Omar Farag Rashed (1061007), Ahmed Ibrahim Alali (1052713), Nasser Mohammed Salem Ahmed (1065285), Prepared By:
Eng. Tasnim Basmaji Eng. Maha Yaghi

Abstract—implementing basic signals on matlab plus Part 2: Unit Impulse


performing some signal operations, Getting the energy In this section we made the definition of the impulse
and power of a signal plus Fourier coefficients of signal for a specified period of time as the following code
signals on matlab. Processing on signals can be done on used.
matlab easily. t=-10:0.01:10;
I. SUMMARY OF CONDUCTED EXPERIMENT f=dirac(-t+5);
Using matlab we have written codes to simulate and indx = f == Inf;
f(indx) = 1 ;
do the tasks. First task to implement unit step signal, the plot(t,f)
signal as shown in figure 1 the first difficulty we faced
This is for time domain
how to identify the signal function in matlab without
using the built in one. n=-10:10; f=dirac(-n+2);
indx = f == Inf;
f(indx) = 1 ;
stem(n,f)
Previous code for discrete domain

syms t;
x=2*sin(t);
f=x.*dirac(t-pi/2)
g=int(f,t,-inf,inf)

Multiplication and convolution of delta function

syms t;
f=heaviside(t-5);
diff(f,t)
Fig. 1. Unit step function
g=dirac(t+2);
int(g,t)
Code used for the first task as follows int(g,t,-inf,inf)
t=-10:0.01:10; % step is small enough to represent continuous-time Derivative of unit step is delta function
signal
f=heaviside(t); % step is small enough to represent continuous-time
signal
plot(t,f) ;
Exercise 2: Applying Signal Operations on Basic Signals
%to Shift the signal to the right by three units Code to add two signals as signals can be added and subtracted
g=heaviside(t-3); n=-10:10;
figure(1) x1= 0.5.^n;
plot(t,g) x2= 0.8.^n;
axis([-15 15 -1 2]) x=x1+x2;
%to Shift the signal to the left by four units. plot(n,x)
g=heaviside(t+4)
figure(2) y=x1-x2;
plot(t,g) plot(n,y)
axis([-15 15 -1 2])
%to Flip the signal on the y-axis as shown below. Part 2: Multiplication and Division
k=heaviside(-t); Signals multiplications and division
figure(3)
plot(t,k) n=-10:10;
axis([-15 15 -1 2]) x1= 0.6.^n;
%to Flip, multiply and shift the signal x2= 0.2.^n;
u=heaviside(-2*t+2); x=x1.*x2;
figure(4) plot(n,x)
plot(t,u) Signals must be same length to be multiplied and should not be
axis([-15 15 —1 2])
divided by zero.
Y=x1./x2;
Part 3: Maximum and Minimum
We have investigated how to get a minimum and a maximum for a II. RESULTS AND DATA ANALYSIS AND
signal using matlab INTERPRETATION
n=-20:20;
x=cos(pi*n/4);
stem(n,x)
hold
xmin=min(x);
xmax=max(x);
pmin=find(x==xmin);
pmax=find(x==xmax);
ymin=x(pmin);
ymax=x(pmax);

Exercise 3: Energy and Power of Signals


We have used a formula to calculate the average power and
average energy for a signal. The following code used to calculate
them.
To calculate average energy and average power
P=E/dt , E=∑x^2

Exercise 4: Fourier series


We have created a function to call for using it to obtain Fourier
series
function [a]=FScoeff(x) %This function calculates the fourier
series coeff of any signal
%User should define one period of the signal and call the
%function for it.
N=length(x); % the period of the signal x[n]
n=0:N-1;
for k=0:N-1
Fig. 2 Output from matlab after running the code
a(k+1)=(1/N)*sum(x.*exp(-j*k*2*pi*n/N));
end As seen in figure 2 these are the results obtained from matlab
x = [1,1,1,1,0,0,0,0]; after running the code. Confirm the theoretical results that might
a=FScoeff(x) be obtained after performing the signals operations. As seen in the
first diagram this is the first unit step signal, after we have
N=length(x);
performed the folding property to the signal and the last one is the
a=(1/N)*fft(x)
signal after shifting and re scaling it
Figure 3 output results from plotting in part 4
III. ENGINEERING CONCLUSIONS

This is the Fourier coefficients obtained to get Fourier series and comparing with Fast Fourier transforms. Any signal
can be expanded to sine and cosine waves signal that is the basic of Fourier series and Fourier transform to be used a
lot in signals for converting the signal from time domain to frequency domain.

Signals is very important in engineering lives as we deal with a lot of types and perform a lot of operations on
it on daily basis so this task helps us to understand more in detail while seeing the results instantly and gave us
experience as we dealt with matlab software that is very useful for engineers.

References
i. Roland Priemer (1991). Introductory Signal Processing. World Scientific. p. 1. ISBN 978-9971509194. Archived from the original
on 2013-06-02.
ii. Digital signals". www.st-andrews.ac.uk. Archived from the original on 2017-03-02. Retrieved 2017-12-17.
iii. https://www.mathworks.com/products/signal.html
iv. Signals and Systems: Analysis Using Transform Methods & MATLAB. New York: McGraw Hill. ISBN 978-0073380681.

Potrebbero piacerti anche