Professional Documents
Culture Documents
Lab # 6 MATLAB Importing, Indexing and Flow Control
Lab # 6 MATLAB Importing, Indexing and Flow Control
University of Sharjah
Electrical Engineering Department
Introduction to EEE -0402100
INTRODUCTION:
MATLAB allows you to import different type of data including tables, spreadsheets, images and
sounds. Once imported into MATLAB, you can determine their size and deal with them in the form
of matrices and vectors. Indexing allows you to access a specific element(s) in a vector or a matrix
and either display or modify their values. Conditional statements enable you to select at run time,
which block of code to execute. Moreover, if statement can be followed by an optional else statement,
which executes when the expression is false.
PROCEDURE:
Click on the following link, which will guide you to the MathWorks portal for the University of
Sharjah:
https://www.mathworks.com/academia/tah-portal/university-of-sharjah-31476961.html
Figure 1
University of Sharjah College of Engineering
2. Select the option “Start learning now”, which is shown in Figure-2 below.
Figure 2
3. Sign in to your account created during lab-4 using your university email address and password as
shown in Figure-3 below
Figure 3
Figure 4
University of Sharjah College of Engineering
5. You are supposed to complete chapter 11 to 15 in this session as shown in Figure-5 below.
Figure 5
6. After the completion of assigned chapters, you are supposed to submit the assignment given below
individually through the Blackboard. Screenshot/Save all your results and submit it as a softcopy.
You may also refer to the following videos for more information on (optional):
I Functions Input/Output:
https://www.youtube.com/watch?v=47YrEouBB8M&list=PLgEkkJcwLzjeL2Ywe0g66GaggDQxmV05p&index=15
ASSIGNMENT:
Test cases:
a. T = 89 (h must be returned as 77)
b. T = 121 (h must be returned as 430.25)
2. Create a 1x9 (1 row, 9 columns) vector of random numbers (use randn command “x = randn(1,9)). And
do the following:
a. Test vector x for elements that are less than 0.4. Assign the output to a variable named y.
b. Create a variable A that contains the elements in x that are greater than 0.4.
c. Modify vector x such that any value in it less than 0.4 is replaced by value 0.