You are on page 1of 4

LINEAR ALGEBRA FOR C.E.

EXERCISE 1

INSTRUCTIONS:
1. Perform the following tasks.
2. Use MATLAB editor.
3. Submit your code along with the output in PDF file. Follow the prescribed format for
filename.
4. If answers require explanation, write your answer as a text description.
5. Indicate your Name, Course & Schedule, Date of Submission, and Exercise No. at the
beginning of the code.
6. Late submission will have deduction.

Carlos Miguel Dauz


Civil Engineering (2pm-5pm, Friday)
Date: 8/27/21
Exercise No.1
Task 1
Create a variable myage and store your age in it. Add 2 to the value of the variable. Subtract 3
from the value of the variable. As you do this, observe the Workspace window.

Task 2
Create a variable to store the atomic weight of iron (55.85).

Prepared by Engr. Caiven A. Rasco


Task 3
In what variable would the result of the following expression be stored?
>> 3 + 5

Task 4
There are 1.6093 kilometers in a mile. Create a variable to store a number of miles. Convert this
to kilometers, and store in another variable.

Task 5
Create a variable ftemp to store a temperature in degrees Fahrenheit (°F). Convert this to
degrees Celsius (°C) and store the result in a variable ctemp.

Task 6

Prepared by Engr. Caiven A. Rasco


The following assignment statements either contain at least one error, or could be improved in
some way. Initialize the variable radius (i.e. assign some number to it). First, identify the
problem, and then fix and/or improve them:
>> 33 = number
>> my variable = 11.11;
>> area = 3.14*radius^2;
>> x = 2*3.14*radius;

Explain why the errors occurred.


1. The value comes first before the variable
2. The my and variable has a space in between which makes it unreadable for matlab
3. Radius doesn’t have a value
4. Radius doesn’t have a value

Prepared by Engr. Caiven A. Rasco


Task 7
The combined resistance RT of three resistors R1, R2, and R3 in parallel is given by
1
𝑅𝑇 =
1 1 1
𝑅1 + 𝑅2 + 𝑅3
Create variables for the three resistors and store values in each, and then calculate the
combined resistances.

Task 8
Write a command that will export the variables in your Workspace. Then write a command that
will erase the variables in your Workspace. After that, execute a command that will import the
variables you just exported.

Prepared by Engr. Caiven A. Rasco

You might also like