elg3 1 2 5 signal and system analysis lab2 signal
play

ELG3 1 2 5 Signal and System Analysis Lab2: Signal Manipulation - PowerPoint PPT Presentation

ELG3 1 2 5 Signal and System Analysis Lab2: Signal Manipulation and Graphics TA: Jungang Liu School of Information Technology and Engineering (SITE) Outline 1. Periodic Signals 2. Signal Combination 3. Matlab Graphing


  1. ELG3 1 2 5 Signal and System Analysis Lab2: Signal Manipulation and Graphics TA: Jungang Liu School of Information Technology and Engineering (SITE)

  2. Outline 1. Periodic Signals 2. Signal Combination 3. Matlab Graphing http://www.mathworks.com MATLab Manual ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  3. Continuous-Time Sinusoidal Signals � Sine signal with period T: 1 π 2 0.8 = y sin( t ) 0.6 T 0.4 � Example: 0.2 0 T=6; %Period -0.2 t=0:0.01:60; -0.4 -0.6 y=sin(2*pi/T.*t); -0.8 plot(t,y),grid; -1 0 10 20 30 40 50 60 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  4. Exponential Function Signal 150 � Exponential function ω t = 0 x e 100 � Example: t=0:0.01:20; omega=1; ; 50 y=exp(omega .*t); plot(t,y),grid; 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  5. Plot Two Continuous-time Signals in One Graph (Method1) 1 0.8 � Use plot function 0.6 %Sinusoidal 1 0.4 T=6; t1=0:0.01:20; 0.2 0 y1=sin(2*pi/T.*t1); -0.2 %Sinusoidal 2 -0.4 t2=0:0.01:20; -0.6 y2=sin(4*pi/T.*t2); -0.8 -1 plot(t1,y1,'r',t2,y2,'b'),grid; 0 2 4 6 8 10 12 14 16 18 20 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  6. Plot Two Continuous-time Signals in One Graph (Method2) � Use hold function 1 % Sinusoidal 1 0.8 T=6; t1=0:0.01:20; 0.6 y1=sin(2*pi/T.*t1); 0.4 plot(t1,y1,'r‘); 0.2 hold on 0 %Sinusoidal 2 -0.2 t2=0:0.01:20; -0.4 -0.6 y2=sin(4*pi/T.*t2); -0.8 plot(t2,y2,'b'); -1 grid on; 0 2 4 6 8 10 12 14 16 18 20 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  7. Square Wave 1.5 � Square wave with period T. � Example: 1 t=0:0.01:20; 0.5 T=5; %period 0 y=sign(sin(2*pi/T.*t)); -0.5 % or y=mod(t.*1/T,1)>1/2; plot(t,y),grid; -1 axis([0 20 -1.5 1.5]); -1.5 0 2 4 6 8 10 12 14 16 18 20 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  8. Discrete-Time Sinusoidal Signals 1 0.8 � Sine signal with period N: 0.6 0.4 0.2 � Example: 0 n=0:20; -0.2 m=1; -0.4 N=7; %period -0.6 y=sin(2*pi*m/N.*n); -0.8 stem(n,y),grid; -1 0 5 10 15 20 25 30 . ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  9. Discrete-Time Sinusoidal Signals (Homework 1-26 b) � Cosine signal x[n]=cos(n/8-pi) � Code n=0:600; x=cos(n./8-pi); stem(n,x) grid on; � Result(next page): Not periodic, and this verifies our analysis in the tutorial class. ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  10. X[ n] = cos(n/ 8-pi) Result: NOT periodic 1 0.8 0.6 0.4 X= 114 0.2 X= 164 X= 13 Y= 0.11259 Y= 0.079564 X= 63 Y= 0.054177 Y= 0.021017 0 -0.2 -0.4 -0.6 -0.8 ELG3125 Signal and System Analysis Fall 2010 -1 0 20 40 60 80 100 120 140 160 180 200 School of Information Technology and Engineering

  11. Discrete-Time Sinusoidal Signals Homework 1-26 c) 1 � x[n]=cos((pi/8)n 2 ) 0.8 � Code 0.6 0.4 n=0:100; 0.2 x=cos(power(n,2)*pi/8); 0 stem(n,x,’r’),grid; -0.2 -0.4 � Result: period N=8; -0.6 -0.8 -1 0 5 10 15 20 25 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  12. Discrete-Time Exponential Signals � Exponential signal 150 y[n]=e -n � Example 100 n=0:10; y=exp(0.5*n); 50 stem(n,y),grid; 0 0 1 2 3 4 5 6 7 8 9 10 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  13. Combination of Two Continuous-Time Signals 1.5 t=0:0.01:20; 1 T1=2; T2=4; 0.5 y1=cos(2*pi/T1*t); 0 y2=sin(2*pi/T2*t); -0.5 y3=y1+y2; -1 plot(t,y3),grid; -1.5 -2 0 2 4 6 8 10 12 14 16 18 20 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  14. Combination of Two Discrete-Time Signals1 ------Addition � Code 1.5 n=0:60; 1 N1=2; m1=3; 0.5 N2=4; 0 m2=2; y1=cos(m1/N1*2*pi.*n); -0.5 y2=sin(m2/N2*2*pi.*n); -1 y3=y1+y2; -1.5 stem(n,y3),grid; 0 10 20 30 40 50 60 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  15. Combination of Two Discrete-Time Signals2 ------Multiplication � Homework 1.26 d) 1 � x[n]=cos[pi*n/2]cos[pi*n/4] 0.8 0.6 0.4 � Code 0.2 n=-15:15; 0 x= cos(pi.*n/2)*cos(pi.*n/4) -0.2 Stem(n,x),grid -0.4 -0.6 -0.8 Result: period N=8 -1 (It verifies our analysis in the -15 -10 -5 0 5 10 15 tutorial class.) ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  16. 3 -D Plotting • 3-D analog of plotting function. • Function: plot3(x,y,z) • When x, y and z are three vectors of the same length, it plots a line in 3-D through the points whose coordinates are the elements of x, y and z. ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  17. View • 3-D graph viewpoint specification. • Used together with plot3. • Function: view(AZ,EL) • AZ: Azimuth rotation in degree, which revolves z-axis, with positive values indicating counter- clockwise rotation of the viewpoint. • EL: Elevation in degree, with positive values corresponding to moving above the object. ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  18. Axis • By default, Matlab finds the maximum and minimum of data to choose the axis limits. • Axis is used to control axis scaling and appearance. • Function: axis([xmin xmax ymin ymax]) for 2-D plot. axis([xmin xmax ymin ymax zmin zmax]) for 3-D plot. • axis auto returns the axis scaling to its default. ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  19. 3D Plotting Example � y = e j (2 pi / T)t with period T. (Euler’s formula: 1 e jx = cos(x) + j sin(x)) � Code 0.5 T=6; 0 t=0:0.01:10; y=exp(j*2*pi/T.*t); -0.5 figure(1); plot3(t,real(y),imag(y)); -1 1 grid on; 0.5 30 0 20 axis square; -0.5 10 -1 0 ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

  20. Enjoy signal…… ELG3125 Signal and System Analysis Fall 2010 School of Information Technology and Engineering

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend