You are on page 1of 9

Republic of the Philippines

CENTRAL LUZON STATE UNIVERSITY


College of Engineering
DEPARTMENT OF CIVIL ENGINEERING
CENGR 3140 LAB
(Numerical Solutions to CE Problem)

Full Name: RABANAL, EULLYZEN P. ID Number: 19-2422

Laboratory Work No. 1


GNU OCTAVE FUNDAMENTALS

OBJECTIVE:
a. Learning how vectors and matrices are assigned values using simple
assignment, the colon operator, and the linspace functions.
b. Gaining a general understanding of built-in functions of GNU Octave.
c. Learning how to use vectors to create a simple line plot based on an equation.

EQUIPMENT:
a. Personal computer

PROCEDURES:

The velocity of a free-falling bungee jumper can be computed with the equation:

where 𝑔 is the acceleration due to gravity (9.81 m/s2), 𝑚 is mass (kg), 𝑐􀯗 is the drag

coefficient (kg/m), and t is time (s).

Data for the mass and associated terminal velocities of a number of jumpers is given

below.
Drag coefficient can be computed using the equation involving the terminal velocity.

a. Assign value to the acceleration due to gravity 𝑔.

b. Using Eq. 2, compute for the mean drag coefficient in GNU Octave.

𝑐􀯗 = ____________________

c. Create a column vector 𝑡 that contains values from 0 to 20 in steps of 2.

d. Check the number of items in the 𝑡 array with the 𝑙𝑒𝑛𝑔𝑡ℎ function.

e. Assign the last two digits of your ID number as the mass in kilograms to

variable 𝑚. If 00, assume the value of 50.

f. Evaluate Eq. 1 assigning it as column vector 𝑣.

g. Plot the 𝑡 and 𝑣 arrays using the plot function [>>plot(t,v)].

h. Customize the graph a bit to have the following features:

● Set the type of point symbols, line type and color to your liking

[>>plot(t,v, ‘▢▢▢’)]

● Title: Plot of v versus t [>>title(‘Plot of v versus t’)]

● Horizontal axis: Values of t [>>xlabel(‘Values of t’)]

● Vertical axis: Values of v [>>ylabel(‘Values of v’]

● Grid lines visible [>>grid]

i. Based on the results of 𝑣 and the graph, estimate your terminal velocity to the

nearest tenths.

𝑣􀯧 = ____________________
RESULTS:

(Attach images of the GNU Octave command window, workspace, and/or graph showing the inputs and
the results of the above procedures)
GUIDE QUESTIONS:
1. In your opinion, what is the most useful function of GNU Octave and why?

The capacity of this application to change, arrange, and convert is its most helpful feature; like a
computer calculator, it immediately displays the results. This application simplifies those time-
consuming stages, from straightforward array transformation to plain forward charting, even if it's
preferable to understand what happens with each command presented.

2. What problems did you encounter in performing the laboratory exercise?

Even if the software doesn't have a particularly high learning curve, studying the symbols and
instructions is still a preferable place to start if you don't already have a thorough understanding of
what you want to accomplish with it.

3. What could be done to improve the accuracy of the graph and the determination of terminal
velocity?
It will be simpler to compare each coordinate to one another if there is a pin system or
symbol that displays all of the coordinates and their specifics of coordination.

4. For you, what is the most crucial part of using GNU Octave as a tool in

performing mathematical calculations?

Understanding how the formula or the activities are being executed, not by just solving it, but by
learning how you solve it.

CONCLUSION:
It's entertaining to solve issues with Octave. It offers a variety of tools to aid people in navigating
their way to the desired outcomes. This is exactly like programming, where each action has a purpose
and is always considered when issuing subsequent orders if it is a component of the next equation to
solve. With adequate program comprehension and command mastery, this calculator can perform a
larger variety of operations than our typical calculator, including the usage of variables and the ability to
assign values to words.
PRACTICE PROBLEMS:

1. Use the linspace function to create vectors identical to the following created
with colon notation:
a. t = 4:6:61
b. x = -4:4
2. The following matrix is entered in Octave:
>>A=[1 2 5;0:0.5:1;linspace(6,8,3)]
a. Write out the resulting matrix.

b. Write a single-line command to multiply the second row by the third


column and assign the result to the variable c. Hint: To pertain to a single row
or column in a matrix, input the matrix name followed by (▢,▢). Input the row number
if pertaining to a row then a colon [e.g. A(1,:) to pertain to the first row of matrix A] and
input the column number if pertaining to a column then a colon [e.g. A(:,1) to pertain to
the first column of matrix A].
3. If a force 𝐹(N) is applied to compress a spring, its displacement 𝑥(m) can often
be modeled by Hooke’s Law:
𝐹 = 𝑘𝑥
where 𝑘 = the spring constant (N/m). The potential energy stored in the spring
𝑈(J) can then be computed as

Five springs are tested and the following data compiled:

Use Octave to store 𝐹 and 𝑥 as vectors and then compute vectors of the spring
constants and the potential energies. Use the max function to determine the
maximum potential energy.
4. It is general practice in engineering and science that equations be plotted as
lines and discrete data as symbols. Here are some data for concentration (𝑐)versus time (𝑡) for the photo
degradation of aqueous bromine:

These data can be described by the following function:

Use Octave to create a plot displaying both the data (using diamond-shaped
symbols) and the function (using a green, dashed line). Plot the function for t
= 0 to 70 min at five minute intervals.

You might also like