0% found this document useful (0 votes)
101 views3 pages

Mat Lab 2024

Uploaded by

as739562978
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views3 pages

Mat Lab 2024

Uploaded by

as739562978
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Year: 2023/24

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.

Enter the first dimension of the matrix: 2


Enter the second dimension of the matrix: 3
--------------------------------

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

MATLAB Exercises | Lect. Mohammed Gawad 1


4. If you have the matrix [A], and the matrix [B], print the result matrix [C] and [D];
[C] = [A] + [B]
[C] = [A] - [B]

[A] =
2 4
6 8
10 12

[B] =
1 3
5 7
9 11

[C] = [A] + [B]


3 7
11 15
19 23

[D] = [A] - [B]


1 1
1 1
1 1

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

MATLAB Exercises | Lect. Mohammed Gawad 2


7. If you know that the volume of a cylinder = [pi × square (radius) × height], create a
script or a function to find the volume?

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

MATLAB Exercises | Lect. Mohammed Gawad 3

You might also like