Presentation is loading. Please wait.

Presentation is loading. Please wait.

ENEE222 Elements of Discrete Signal Analysis Lab 3 1.

Similar presentations


Presentation on theme: "ENEE222 Elements of Discrete Signal Analysis Lab 3 1."— Presentation transcript:

1 ENEE222 Elements of Discrete Signal Analysis Lab 3 1

2 Prepare your working environment
Download the script for lab 2 from ELMS or: terpconnect.umd.edu/~rssaketh/ene222/lab Move files to your desktop Double click the MATLAB icon on the desktop In MATLAB, set “Current Folder” to your desktop Double click the file “lab_03_script.txt” inside MATLAB 2

3 Problem 1 – For Loop FOR loop in Matlab:
Question: Will i always have ubound as its last value? Why or why not? for i=lbound:step:ubound statement end 3

4 Problem 2 – M-file revisit
A script file is a collection of MATLAB commands, saved with the .M extension: SCRIPT_FILE.M To execute these commands, make sure the file is in the working MATLAB directory, and simply type: SCRIPT_FILE in the command window. 4

5 Problem 3 – Mandelbrot Fractal
5

6 Problem 3 – Mandelbrot fractal
All points (c=x+j*y) which fulfill where zn is iteratively obtained by Examples: c = 0, {|zn|} = {0,0,0, …} c = −0.1, {|zn|} = {0, -0.1, -0.09, , ...} c = j, {|zn|} = {0, j, -1 + j, -j, -1 + j, ...} Im Re 6

7 Problem 4 – while loop WHILE loop in Matlab: # of iterations
while (condition_to_continue) statement end # of iterations Early termination FOR Known Indirect (BREAK statement) WHILE Need not to be known Straightforward 7

8 continuFlag = ~termFlag
Problem 4 – Early termination WHILE v.s. FOR: for i=lbound:step:ubound statement if (termFlag) break end while (continuFlag) statement end Note that continuFlag is the logical complement of termFlag, i.e., continuFlag = ~termFlag 8


Download ppt "ENEE222 Elements of Discrete Signal Analysis Lab 3 1."

Similar presentations


Ads by Google