CS 211 Lesson 18

Complex and Integer Data Types

Quote:

Always do everything you ask of those you command. George S. Patton

Lesson Objectives:

Lesson:

I. MATLAB Concepts

A. Data Types and Data Structures - an introduction to the next 5 lessons

B. Complex numbers

t = 0:pi/20:4*pi;
y = exp(-0.2*t) .* (cos(t) + i*sin(t)); % any function that creates complex values
 
plot the real part only plot(t, y)
plot the imaginary part only plot(t, imag(y))
plot real vs. imaginary plot(y)
plot the complex values in polar coordinates polar(angle(y), abs(y))

C. Integer data types

a = int8(100);
b = int8(100);
disp(a + b)

c = uint16(10000);
d = uint16(10);
disp(c * d)

II. Good Programming Practices

III. Algorithms

Lab Work: Lab 18

References:  Chapman Textbook 6.1, 6.4 (3rd edition only) and  http://en.wikipedia.org/wiki/Complex_number