Case Study in Matlab

47

Transcript of Case Study in Matlab

Page 1: Case Study in Matlab
Page 2: Case Study in Matlab

Sta

rtin

g M

AT

LAB

So

ftw

are

�F

rom

th

e d

esk

top

—D

ou

ble

-cli

ck t

he

MA

TL

AB

ico

n

(cal

led

a s

ho

rtcu

t) t

hat

th

e in

stal

ler

crea

tes

on

yo

ur

des

kto

p.

Page 3: Case Study in Matlab

Co

nt.

.�

Fro

m t

he

Sta

rt m

enu

—C

lick

th

e S

tart

bu

tto

n,

sele

ct

Pro

gra

ms,

an

d m

ove

th

e p

oin

ter

ove

r th

e M

AT

LA

B

entr

y. S

elec

t th

e ve

rsio

n o

f M

AT

LA

B y

ou

wan

t to

sta

rt

and

, o

n t

he

app

lica

tio

n m

enu

th

at a

pp

ears

, cl

ick

th

e M

AT

LA

B e

ntr

y.

Page 4: Case Study in Matlab

MA

TLA

B -

WIN

DO

WS

�C

om

man

d W

ind

ow

�C

om

man

d H

isto

ry

�C

urr

ent

Dir

ecto

ry

�W

ork

Sp

ace

Page 5: Case Study in Matlab

Co

nt.

.

Page 6: Case Study in Matlab
Page 7: Case Study in Matlab

MA

TLA

B-

HE

LP

Page 8: Case Study in Matlab

Op

en

ing

M-F

ile

Page 9: Case Study in Matlab

M-F

ILE

Page 10: Case Study in Matlab

Exe

cuti

ng

M

-fil

e

Page 11: Case Study in Matlab

Vie

win

g o

utp

ut

Page 12: Case Study in Matlab

Co

nt.

.

Page 13: Case Study in Matlab

Ed

itin

g f

igu

re

Page 14: Case Study in Matlab

Co

mm

un

ica

tio

ns

To

olb

ox

�C

om

mu

nic

atio

ns

To

olb

ox

soft

war

e ex

ten

ds

the

MA

TL

AB

tec

hn

ical

co

mp

uti

ng

en

viro

nm

ent

wit

h

fun

ctio

ns,

plo

ts,

and

a g

rap

hic

al u

ser

inte

rfac

e fo

r ex

plo

rin

g,

des

ign

ing

, an

alyz

ing

, an

d s

imu

lati

ng

al

go

rith

ms

for

the

ph

ysic

al l

ayer

of

com

mu

nic

atio

n

syst

ems

Page 15: Case Study in Matlab

Ke

y f

ea

ture

s

�F

un

ctio

ns

for

des

ign

ing

th

e p

hys

ical

lay

er o

f co

mm

un

icat

ion

s li

nk

s, i

ncl

ud

ing

so

urc

e co

din

g, c

han

nel

co

din

g, i

nte

rlea

vin

g, m

od

ula

tio

n, c

han

nel

mo

del

s, a

nd

eq

ual

izat

ion

�P

lots

su

ch a

s ey

e d

iag

ram

s an

d c

on

stel

lati

on

s fo

r vi

sual

izin

g c

om

mu

nic

atio

ns

sig

nal

s

�G

rap

hic

al u

ser

inte

rfac

e fo

r co

mp

arin

g t

he

bit

err

or

rate

of

you

r sy

stem

wit

h a

wid

e va

riet

y o

f p

rove

n a

nal

ytic

al

resu

lts

Page 16: Case Study in Matlab

Mo

du

lati

on

Fe

atu

res

Page 17: Case Study in Matlab

Ch

an

ne

l F

ea

ture

s

�ch

an =

mim

och

an(n

t, n

r, t

s, f

d)

con

stru

cts

a m

ult

iple

-in

pu

t m

ult

iple

-ou

tpu

t (M

IMO

) R

ayle

igh

fad

ing

ch

ann

el o

bje

ct w

ith

a

sin

gle

pat

h l

ink

.

�n

t is

th

e n

um

ber

of

tran

smit

an

ten

nas

.

�n

r is

th

e n

um

ber

of

rece

ive

ante

nn

as.

�n

t an

d n

r ca

n b

e in

teg

er v

alu

es f

rom

1 t

o 8

.

�ts

is

the

sam

ple

tim

e o

f th

e in

pu

t si

gn

al, i

n s

eco

nd

s.

�fd

is

the

max

imu

m D

op

ple

r sh

ift,

in

her

tz.

Page 18: Case Study in Matlab

CA

SE

-ST

UD

Y

Page 19: Case Study in Matlab

Co

ntr

ol

Syst

em

To

olB

ox

�It

bu

ild

s o

n t

he

fou

nd

atio

ns

of

MA

TL

AB

to

pro

vid

e fu

nct

ion

s d

esig

ned

fo

r co

ntr

ol

eng

inee

rin

g.

�It

is

a co

llec

tio

n o

f al

go

rith

ms,

wri

tten

as

M-f

iles

, th

at

imp

lem

ents

co

mm

on

co

ntr

ol

syst

em d

esig

n,

anal

ysis

, an

d m

od

elin

g t

ech

niq

ues

.�

Co

nve

nie

nt

gra

ph

ical

use

r in

terf

aces

(GU

Is)

sim

pli

fy t

ypic

al c

on

tro

l en

gin

eeri

ng

tas

ks.

Page 20: Case Study in Matlab

Cre

ati

ng

Tra

nsf

er

Fu

nct

ion

Mo

de

ls

�T

ran

sfer

fu

nct

ion

(T

F)

mo

del

s c

an

be

crea

ted

by

spec

ifyi

ng

Nu

mer

ato

r co

effi

cien

ts a

nd

�D

eno

min

ato

r co

effi

cien

ts.

Page 21: Case Study in Matlab

EXAMPLE:

�n

um

= [

1 0

];

�d

en =

[1

2 1]

;

�sy

s =

tf(

nu

m,d

en)

�T

ran

sfer

fu

nct

ion

:

s

----

----

----

-

s^2

+ 2

s +

1

Page 22: Case Study in Matlab

Exa

mp

le o

f C

rea

tin

g Z

ero

-Po

le-

Ga

in M

od

els

�T

o c

reat

e ze

ro-p

ole

-gai

n (

ZP

K)

mo

del

s, s

pec

ify

each

o

f th

e th

ree

com

po

nen

ts i

n v

ecto

r fo

rmat

.

�sy

s =

zp

k(z

,p,k

)

�cr

eate

s a

con

tin

uo

us-

tim

e ze

ro-p

ole

-gai

n m

od

el w

ith

ze

ros

z, p

ole

s p

, an

d g

ain

(s)k

.

�T

he

ou

tpu

t sy

s is

a Z

PK

ob

ject

sto

rin

g t

he

mo

del

dat

a

Page 23: Case Study in Matlab

Co

nt.

.�

In t

he

SIS

O c

ase,

th

e tr

ansf

er f

un

ctio

n i

s re

pre

sen

ted

as

: �z

and

p a

re t

he

vect

ors

of

real

-o

r co

mp

lex-

valu

ed z

ero

s an

d

po

les,

an

d k

is

the

real

-o

r co

mp

lex-

valu

ed s

cala

r g

ain

Page 24: Case Study in Matlab

Exa

mp

le:

sys

= z

pk

([0

],[-

1 -1

],[1

])

Zer

o/p

ole

/gai

n:

s

----

---

(s+

1)^

2

Page 25: Case Study in Matlab

BO

DE

PLO

T�

bo

dep

lot(

sys,

w)

�d

raw

s th

e B

od

e p

lot

for

freq

uen

cies

sp

ecif

ied

by

w.

�W

hen

w =

{w

min

,wm

ax},

th

e B

od

e p

lot

is d

raw

n f

or

freq

uen

cies

bet

wee

n w

min

an

d w

max

(in

rad

/s).

sys

= t

f(1,

[1 1

]);

h =

bo

dep

lot(

sys)

Page 26: Case Study in Matlab

Co

nt.

.

Page 27: Case Study in Matlab

Ne

ura

l N

etw

ork

s

Neu

ral n

etw

orks

are

com

pose

d of

sim

ple

elem

ents

ope

ratin

g in

pa

ralle

l. T

hese

ele

men

ts a

re in

spire

d by

bio

logi

cal n

ervo

us

syst

ems.

Page 28: Case Study in Matlab

On

e –

inp

ut

Ne

uro

n:

Page 29: Case Study in Matlab

A o

ne

-la

ye

r n

etw

ork

wit

h R

in

pu

t

ele

me

nts

an

d S

ne

uro

ns

Page 30: Case Study in Matlab
Page 31: Case Study in Matlab

Ima

ge

Pro

cess

ing

To

olB

ox

�T

o i

den

tify

th

e ed

ges

in

an

im

age

Page 32: Case Study in Matlab

Ed

ge

De

tect

ors

Page 33: Case Study in Matlab

Co

nt.

.

Page 34: Case Study in Matlab

Co

nt.

.

Page 35: Case Study in Matlab

Ed

ge

de

tect

ion

�I

= i

mre

ad('

circ

uit

.tif

');

�B

W1

= e

dge

(I,'p

rew

itt'

);

�im

sho

w(B

W1)

;

�fi

gu

re,

imsh

ow

(BW

2)

Page 36: Case Study in Matlab

Re

sult

s

Sob

el

Can

ny

Page 37: Case Study in Matlab

Alg

ori

thm

Ste

p 1

: Acq

uire

Imag

e

�S

tep

2: C

alcu

late

Sam

ple

Co

lors

in L

*a*b

Col

or

Sp

ace

for

Eac

h R

egio

n

�S

tep

3: C

lass

ify E

ach

Pix

el U

sin

g th

e N

eare

st N

eig

hbo

r R

ule

�S

tep

4: D

isp

lay

Res

ults

of N

eare

st N

eig

hbo

r C

lass

ific

atio

n

Ste

p 5

: Dis

pla

y 'a

' an

d 'b

' Val

ues

of t

he

Lab

eled

Co

lors

Page 38: Case Study in Matlab

Ste

p 1

: a

cqu

ire

im

ag

e�

fab

ric

= g

etsn

apsh

ot(

vid

);

Page 39: Case Study in Matlab

Ste

p 2

: C

alc

ula

te S

am

ple

Co

lors

in

Co

lor

Sp

ace

fo

r E

ach

Re

gio

n�

colo

rNam

es =

{

'red

','gr

een

','p

urp

le','

blu

e','y

ello

w' }

;�

nC

olo

rs =

len

gth

(co

lorN

ames

);�

sam

ple

_reg

ion

s =

fal

se([

imag

eHei

ght

imag

eWid

th n

Co

lors

]);

�%

Sel

ect

each

sam

ple

reg

ion

.�

f =

fig

ure

;�

for

cou

nt

= 1

:nC

olo

rs�

set(

f, 'n

ame'

, ['

Sel

ect

sam

ple

reg

ion

fo

r '

colo

rNam

es{c

ou

nt}

] );

�sa

mp

le_r

egio

ns(

:,:,

cou

nt)

= r

oip

oly

(fab

ric)

;�

end

�cl

ose

(f);

�%

Dis

pla

y a

sam

ple

reg

ion

.�

imsh

ow

(sam

ple

_reg

ion

s(:,

:,1)

)�

titl

e(['

sam

ple

reg

ion

fo

r ' c

olo

rNam

es{1

}]);

Page 40: Case Study in Matlab
Page 41: Case Study in Matlab

Re

slu

ts 1

Mnp

: 30,

per

cent

0.0

5, c

lust

er n

umbe

r 4

Mnp

: 20

, per

cent

0.0

5, c

lust

er n

umbe

r 7

Orig

inal

pic

ture

s

seg

men

ted

pict

ures

Page 42: Case Study in Matlab

Sig

na

l P

roce

ssin

g T

oo

lbo

x�

sup

po

rts

a w

ide

ran

ge

of

sig

nal

pro

cess

ing

op

erat

ion

s,

fro

m w

avef

orm

gen

erat

ion

to

fil

ter

des

ign

an

d

imp

lem

enta

tio

n,

par

amet

ric

mo

del

ing

, an

d s

pec

tral

an

alys

is.

�p

rovi

des

tw

o c

ateg

ori

es o

f to

ols

�co

mm

and

-lin

e fu

nct

ion

s an

d

�g

rap

hic

al u

ser

inte

rfac

es

Page 43: Case Study in Matlab

Co

mm

an

d-L

ine

Fu

nct

ion

s�

Dis

cret

e-ti

me

filt

er d

esig

n, a

nal

ysis

, an

d i

mp

lem

enta

tio

n

�A

nal

og

fil

ter

des

ign

, an

alys

is, a

nd

im

ple

men

tati

on

�L

inea

r sy

stem

tra

nsf

orm

atio

ns

�W

ind

ow

s

�S

pec

tral

an

alys

is

�S

tati

stic

al s

ign

al p

roce

ssin

g

�P

aram

etri

c m

od

elin

g

�L

inea

r p

red

icti

on

�M

ult

irat

e si

gn

al p

roce

ssin

g

�W

avef

orm

gen

erat

ion

Page 44: Case Study in Matlab

Gra

ph

ica

l U

ser

Inte

rfa

ces

�F

ilte

r d

esig

n a

nd

an

alys

is

�W

ind

ow

des

ign

an

d a

nal

ysis

�S

ign

al p

lott

ing

an

d a

nal

ysis

,

�sp

ectr

al a

nal

ysis

, an

d f

ilte

rin

g

Page 45: Case Study in Matlab

Fil

ter

De

sig

n a

nd

Im

ple

me

nta

tio

n�

To

des

ign

a f

ifth

-ord

er 3

0 H

z lo

wp

ass

Bu

tter

wo

rth

fi

lter

an

d a

pp

ly i

t to

th

e d

ata

in v

ecto

r x:

�[b

,a]

= b

utt

er(5

,30

/50

);

�H

d =

dfi

lt.d

f2t(

b,a

);

% D

irec

t-fo

rm I

I tr

ansp

ose

d

�y

= f

ilte

r(H

d,x

);

%

stru

ctu

re

Page 46: Case Study in Matlab

WIN

DO

W D

ES

IGN

AN

D A

NA

LYS

IS

TO

OL

Page 47: Case Study in Matlab

CO

NV

OLU

TIO

N &

DE

CO

NV

OLU

TIO

N

�a

= [

1 2

3];

�b

= [

4 5

6];

�c

= c

on

v(a,

b)

�c

=

�4

13

28

27

18

�d

eco

nv

to d

eco

nvo

lve

b f

rom

c:

�[q

,r]

= d

eco

nv(

c,a)

�q

=

�4

5

6

�r

=

�0

0

0

0

0