Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio...

Post on 17-Jan-2016

224 views 0 download

Transcript of Today C/C++:.h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio...

Today C/C++: .h/.cpp; compiling and linking Fourier Transform (corrected) Nyquist Theorem Audio sampling rates

SE-2811Slide design: Dr. Mark L. Hornick

Content: Dr. HornickErrors: Dr. Yoder

1

SE3910Week 6, Class 1

Ex: C/C++ (Review)

Why do we have both .h and .cpp file extensions for C++? Why not just have .cpp (like .java for Java classes)?

Answer these questions:

1. What should you put into a class’s .h file?

2. What should you put into a class’s .cpp file?

[Note: On next lab, use .hpp and .cpp instead of .h and .cpp]

SE-2811Dr.Yoder 2

Compiling and Linking

Compiling Converting individual .c or .cpp file to object code

Linking Combining multiple object (.o) files into an

excecutable (usually without extension, or .exe on Windows)

SE-2811Dr.Yoder 3

Ex: C/C++

Circle the link-time errors. Box the compile-time syntax error warning: implicit declaration of function `...' point.m:40: error: ‘mypoint’ undeclared (first use in

this function) parse error before `...‘ collect2: ld returned 1 exit status undefined reference to `filterText' /usr/lib/crt1.o(.text+0x18): undefined reference to

`main 'SE-2811Dr.Yoder 4

Network Latency with resmon.exe

SE-2811Dr.Yoder 5

Signals as sums of sine-waves

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling

6http://mathworld.wolfram.com/FourierSeriesSquareWave.html

http://ccn.ucla.edu/BMCweb/SharedCode/slides/SlideFiles.html

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling7

Sampling Theorem (again Nyquist)

fs = 2B (B is bandwidth of signal)

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling8

Ex: If this is 1 second,what is the output if we sample 3 times per second?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling9

0 60 120 180 240 300 360 420 480 540 600 660 720 780 840 900 960 1020 1080

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Units: dB

What is a decibel?

A tenth of a bel

What is a bel?

The log10 of some ratio.

X dB = 10 log10 (Y)

Ex: How to compute Y from X?

X – in units of dB

Y – simple ratio (unitless) e.g. signal power / noise power 10

In-class Activity: Analog to digital bandwidth

Suppose you would like to send video in a (relatively) low-frequency with a narrow bandwidth of 1 Mhz

The connection is fairly noisy and you can only get 20dB SNR

What bit-rate can you achieve?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling

11

Ex:

What are two ways we can avoid the stroboscopic effect in a video game simulation of a rotating wheel?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling12

Muddiest Point

Wait for the slides, or follow this link to answer both questions at once: http://bit.ly/1Mow5a3

SE-2811Dr.Yoder 13

Muddiest Point

Wait for the slides, or follow this link to answer both questions at once: http://bit.ly/1Mow5a3

SE-2811Dr.Yoder 14

SE-2811Dr. Josiah Yoder 15

http://bit.ly/1Mow5a3

SE-2811Dr. Josiah Yoder 16

http://bit.ly/1Mow5a3

References

EB: Derek Malloy, Exploring Beaglebone, Wiley, 2015

http://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_95.html

http://www.network-theory.co.uk/docs/gccintro/gccintro_95.html

http://stackoverflow.com/questions/5645387/gcc-compile-errors-in-an-basic-example-objc-program

http://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_94.html

SE-2811Slide design: Dr. Mark L. Hornick

Content: Dr. HornickErrors: Dr. Yoder

17