1 NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Networks and Communication Department Lab 3: Matlab – Sinusoidal&Exercises 2 Sinusoidal Time & Frequency domain continuous or discrete signals Networks and Communication Department continuous or discrete signals 3 Continuous-Time Signals: A signal is continuous-time signal if the independent variable t is continuous. Discrete-Time Signals: • A signal is defined at discrete times, a discrete-time signal is often identified as a sequence of numbers, denoted by • A very important class of discrete-time signals is obtained by sampling a continuous-time signal IN MATLAB: command plot used to sketch the continuous time signals IN MATLAB: command stem used to sketch the discrete time signals Networks and Communication Department Plotting Time domain using Matlab 4 Time Domain concept A general sine wave in time domain can be represented by three parameters : Peak amplitude (A) Frequency (f) Phase (φ) s(t) = A sin(2π f t +Φ) Networks and Communication Department Plotting Time domain using Matlab 5 Time Domain Example: Plot and stem the time domain signal 7*sin(2*pi*2000*t+pi), t=0:0.05:3 Matlab Example Networks and Communication Department Plotting Frequency domain using Matlab 6 Frequency Domain Using discipline Known as Fourier analysis (any signal is made up of components at various frequencies, in which each component is a sinusoid ). Eg. s(t) = [(4/π) x (sin(2πft) + (1/3) sin(2π(3f)t)] concept Networks and Communication Department Plotting Frequency domain using Matlab 7 Frequency Domain Matlab Plot each signals alone the show the frequency domain( Fourier) signal s(t)=[6*sin(2pi*t+pi)+4*sin(2*pi*3t+pi)+ 2*sin(2*pi*5t+3*pi)] example Networks and Communication Department 8 Networks and Communication Department Exercises Contents 9 Basic exercises Arrays & Matrices Plotting Sinusoid Sampling Networks and Communication Department Basic exercises 10 Let vector x = [5 2 1 6]: 1. A. B. Add 16 to each element Let y = [4 1 3 5], multiply x*y A. Adding 16 to vector x in matlab B. Multiplying two vectors x and y Networks and Communication Department Basic exercises 11 Evaluate the following MATLAB expressions by your hand and use MATLAB for checking your ans.: 2. A. B. 2/2*3 (6 - 2 ) / 5 + 7 ^ 2 – 1 A. B. Hands calculation: 2/2=1 1*3 = 3 In Matlab: Basic exercises 12 Let vector t= 2, 4, 6, 8…20: 3. A. Compute cos^2(t) %Notice that vector t is a starting form 2 and incremented by 2 till 20 % cos^2(t) is written as cos(t).^2 Networks and Communication Department Basic exercises 13 Let vector t= 2, 4, 6, 8…20: 3. B. Exp^t(1+ cos(3t)) % exp^t is written as exp(t). %Notice that vector t is a starting form 2 and incremented by 2 till 20 Arrays & Matrices 14 Given an array A = [ 2 4 1 1. 672 3 5 9] provide the commands needed to: A. assign the first row of A to a vector called x1 %Array in matlab written as each rows separated by ; %assign the first row till end Networks and Communication Department Arrays & Matrices 15 Given an array A = [ 2 4 1 672 3 5 9] provide the commands needed to: 1. B. assign the last 2 rows of A to an array called y % end-1 is row before the last row % end is the last row Networks and Communication Department Arrays & Matrices 16 Given an array A = [ 2 4 1 672 3 5 9] provide the commands needed to: 1. C. compute the square-root of each element of A Networks and Communication Department Arrays & Matrices 17 Transpose the following matrices: 2. A. B. A=[2 7 9 7 ; 3 1 5 6 ; 8 1 2 5] B=[3 2 6 8] A. B. Networks and Communication Department Plotting 18 1. Plot sin(x2) on the interval [-5,5]. Networks and Communication Department Plotting three curve on the interval [0,2π] step π/100 .the curve equation y = sin(x), y2 = sin(x-.25), y3 = sin(x2. Create .5); Sinusoid Sampling 20 1. Sample the sinusoid x = sin(2 pi f t), where f = 2 kHz. And t=0:5T Let x1 be the signal sampled at 10 kHz. Networks and Communication Department Sinusoid Sampling 21 1. Sample the sinusoid x = sin(2 pi f t), where f = 2 kHz. And t=0:5T Let x2 be the signal sampled at 3 kHz Networks and Communication Department Sinusoid Sampling 22 2. Plot frequency domain sinusoid x = sin(2 pi f t), where fs= 8000 Hz. At different frequency tones start from 0 till 1, then multiplying the tones with 2 Networks and Communication Department 23 The End Any Questions ? Networks and Communication Department