Mat Lab 2024
Mat Lab 2024
Republic of Yemen
University of Science & Technology
Subject: MATLAB Exercises
Faculty of Engineer and Computers Date:13/03/2024
Department: Bioengineering Deadline: 10/04/2024
Semester: 2, Level: 3 Papers: 3, Questions: 7
Total Mark: 25
1. Using the script in MATLAB, write the code that gives you a matrix whose two
dimensions are specified by the user, all elements are multiples 5; Print the sum all
elements and the size of matrix, using the "fprintf'" function to organize the
output.
A=
5 10 15
20 25 30
Number of elements: 6
The Total: 105
2. Using the script in MATLAB, write the code that send 3 variables (name , gender,
age) as a table in external file "List.xlsx" located in your desktop.
age gender name
20 Male Ahmed
33 Female Noor
41 Male Salem
25 Female Mariam
3. Using the script in MATLAB, write the code to open Report.txt file and transform
to arrays (branch No.) and (sales in dollar) as below:
BANK REPORT:
1- The sales of branch No. 112: --> $120.000000
2- The sales of branch No. 234: --> $100.000000
3- The sales of branch No. 356: --> $250.000000
4- The sales of branch No. 432: --> $300.000000
[A] =
2 4
6 8
10 12
[B] =
1 3
5 7
9 11
5. Write a function and a custom script, so that the function prints the factorial, square
and root of the number entered by the user in the script and print the result.
6. Design a script program that enters two variables (weight in kilograms and height
in meters); It sends the weight and height to:
- Function (mbi): calculates the average body [bm = weight /height^2].
- Function (test): gives a description of the result as follows:
1- x<19 --> The person is slim
2- x>35 --> The person is excessive obesity
3- others --> The person is fitness
Enter the weight (KG): 90
Enter the height (M): 1.50
The value of MBI = 40.00
**The person is excessive obesity
NOTE:
• Save all answers in only one PDF or Microsoft Word (.docx) file.
• Save the file as your full name.
• To Submit your file: click here