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

elg3 1 2 5 signal and system analysis lab2 signal
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Outline

  • 1. Periodic Signals
  • 2. Signal Combination
  • 3. Matlab Graphing

http://www.mathworks.com MATLab Manual

slide-3
SLIDE 3

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Continuous-Time Sinusoidal Signals Sine signal with period T: Example: T=6; %Period t=0:0.01:60; y=sin(2*pi/T.*t); plot(t,y),grid;

) 2 sin( t T y π =

10 20 30 40 50 60

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

slide-4
SLIDE 4

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Exponential Function Signal

Exponential function Example: t=0:0.01:20;

  • mega=1;

; y=exp(omega .*t); plot(t,y),grid;

t

e x

ω

=

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 50 100 150

slide-5
SLIDE 5

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Plot Two Continuous-time Signals in One Graph (Method1)

Use plot function %Sinusoidal 1 T=6; t1=0:0.01:20; y1=sin(2*pi/T.*t1); %Sinusoidal 2 t2=0:0.01:20; y2=sin(4*pi/T.*t2); plot(t1,y1,'r',t2,y2,'b'),grid;

2 4 6 8 10 12 14 16 18 20

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

slide-6
SLIDE 6

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Plot Two Continuous-time Signals in One Graph (Method2)

Use hold function % Sinusoidal 1 T=6; t1=0:0.01:20; y1=sin(2*pi/T.*t1); plot(t1,y1,'r‘); hold on %Sinusoidal 2 t2=0:0.01:20; y2=sin(4*pi/T.*t2); plot(t2,y2,'b'); grid on;

2 4 6 8 10 12 14 16 18 20

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

slide-7
SLIDE 7

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Square Wave

Square wave with period T. Example: t=0:0.01:20; T=5; %period y=sign(sin(2*pi/T.*t)); % or y=mod(t.*1/T,1)>1/2; plot(t,y),grid; axis([0 20 -1.5 1.5]);

2 4 6 8 10 12 14 16 18 20

  • 1.5
  • 1
  • 0.5

0.5 1 1.5

slide-8
SLIDE 8

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Discrete-Time Sinusoidal Signals

Sine signal with period N: Example: n=0:20; m=1; N=7; %period y=sin(2*pi*m/N.*n); stem(n,y),grid; .

5 10 15 20 25 30

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

slide-9
SLIDE 9

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

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.

slide-10
SLIDE 10

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

X[ n] = cos(n/ 8-pi) Result: NOT periodic

20 40 60 80 100 120 140 160 180 200

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

X= 13 Y= 0.054177 X= 63 Y= 0.021017 X= 114 Y= 0.11259 X= 164 Y= 0.079564

slide-11
SLIDE 11

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Discrete-Time Sinusoidal Signals Homework 1-26 c) x[n]=cos((pi/8)n2) Code n=0:100; x=cos(power(n,2)*pi/8); stem(n,x,’r’),grid; Result: period N=8;

5 10 15 20 25

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

slide-12
SLIDE 12

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Discrete-Time Exponential Signals

Exponential signal y[n]=e-n Example n=0:10; y=exp(0.5*n); stem(n,y),grid;

1 2 3 4 5 6 7 8 9 10 50 100 150

slide-13
SLIDE 13

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Combination of Two Continuous-Time Signals t=0:0.01:20; T1=2; T2=4; y1=cos(2*pi/T1*t); y2=sin(2*pi/T2*t); y3=y1+y2; plot(t,y3),grid;

2 4 6 8 10 12 14 16 18 20

  • 2
  • 1.5
  • 1
  • 0.5

0.5 1 1.5

slide-14
SLIDE 14

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Combination of Two Discrete-Time Signals1

  • -----Addition

Code n=0:60; N1=2; m1=3; N2=4; m2=2; y1=cos(m1/N1*2*pi.*n); y2=sin(m2/N2*2*pi.*n); y3=y1+y2; stem(n,y3),grid;

10 20 30 40 50 60

  • 1.5
  • 1
  • 0.5

0.5 1 1.5

slide-15
SLIDE 15

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Combination of Two Discrete-Time Signals2

  • -----Multiplication

Homework 1.26 d) x[n]=cos[pi*n/2]cos[pi*n/4] Code n=-15:15; x= cos(pi.*n/2)*cos(pi.*n/4) Stem(n,x),grid Result: period N=8 (It verifies our analysis in the tutorial class.)

  • 15
  • 10
  • 5

5 10 15

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

slide-16
SLIDE 16

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

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.

slide-17
SLIDE 17

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

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.

slide-18
SLIDE 18

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

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.
slide-19
SLIDE 19

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

3D Plotting Example

y = ej (2 pi / T)t with period T. (Euler’s formula: ejx = cos(x) + j sin(x)) Code T=6; t=0:0.01:10; y=exp(j*2*pi/T.*t); figure(1); plot3(t,real(y),imag(y)); grid on; axis square;

10 20 30

  • 1
  • 0.5

0.5 1

  • 1
  • 0.5

0.5 1

slide-20
SLIDE 20

ELG3125 Signal and System Analysis Fall 2010

School of Information Technology and Engineering

Enjoy signal……