Net 222: Communications and networks fundamentals (Practical Part) Networks and Communication Department Lab 3: Matlab – Sinusoidal&Exercises
Sinusoidal Time & Frequency domain continuous or discrete signals Networks and Communication Department
continuous or discrete signals 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 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 Example Example: Plot and stem the time domain signal 7*sin(2*pi*2000*t+pi), t=0:0.05:3 Networks and Communication Department
Plotting Frequency domain using Matlab concept 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)] Networks and Communication Department
Plotting Frequency domain using Matlab example 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)] Networks and Communication Department
Networks and Communication Department
Exercises Contents Basic exercises Arrays & Matrices Plotting Sinusoid Sampling Networks and Communication Department
Basic exercises Let vector x = [5 2 1 6]: Add 16 to each element Let y = [4 1 3 5], multiply x*y A. B. Adding 16 to vector x in matlab Multiplying two vectors x and y Networks and Communication Department
Basic exercises Evaluate the following MATLAB expressions by your hand and use MATLAB for checking your ans.: 2 / 2 * 3 (6 - 2 ) / 5 + 7 ^ 2 – 1 A. B. Hands calculation: 2/2=1 1*3 = 3 In Matlab:
Basic exercises Let vector t= 2, 4, 6, 8…20: 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 Let vector t= 2, 4, 6, 8…20: Exp^t(1+ cos(3t)) %Notice that vector t is a starting form 2 and incremented by 2 till 20 % exp^t is written as exp(t).
Arrays & Matrices Given an array A = [ 2 4 1 6 7 2 3 5 9] provide the commands needed to: 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 Given an array A = [ 2 4 1 6 7 2 3 5 9] provide the commands needed to: 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 Given an array A = [ 2 4 1 6 7 2 3 5 9] provide the commands needed to: compute the square-root of each element of A Networks and Communication Department
Arrays & Matrices Transpose the following matrices: B=[3 2 6 8] A. B. Networks and Communication Department
Plotting Plot sin(x2) on the interval [-5,5]. Networks and Communication Department
Plotting 2. Create three curve on the interval [0,2π] step π/100 .the curve equation y = sin(x), y2 = sin(x-.25), y3 = sin(x- .5);
Sinusoid Sampling 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 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 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
The End Any Questions ? Networks and Communication Department