Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

EENATIONAL UNIVERSITY

551MF JHOCSON ST., SAMPALOC, MANILA

COLLEGE OF ENGINEERING

ACTIVITY 00
FUNDAMENTALS OF OCTAVE

Submitted by:

Errol Julian Arco Bautista

John David Ondevilla

Keith Daniel Catarungan

Mark Daniel Villareal

J Johannes Rainier De Jesus

Kaizer Felarca

Lanz Rev M. Delfin


Learning Outcomes:
● Install GNU octave application.
● Learn the basic of GNU octave application.
● Perform the Exercises 1 to 9. Use the pdf file 00 Fundamentals Matlab_Octave pdf
file as reference.
Materials and Resources:
● ECFBCK1L Syllabus
● GNU Octave application
● Powerpoint lessons
● Online resources

Discussion:

Exercise 1:
Exercise 2:
COMMAND
2.1
2.2
2.3
EDITOR
2.1
2.2
2.3
Exercise3:
Exercise 4:
Exercise 5:

6:
EXERCISE 6
Exercise7:
COMMAND
EDITOR
Exercise 8:
Exercise 9:

Conclusion:

Exercise 1.
In this practice, we utilized octave to familiarize students with basic commands. This job
covered fundamental program listings such as constructing a row and column vector, assigning
values, constructing a diagonal matrix, and so on. This exercise was not very difficult, but it
really aided the user in exploring with and understanding the foundations of this program.
Finally, this experiment revealed that octave variables have no starting values. The user must
first set the settings before performing an action.

Exercise 2.
2.1Octave was used in this application to compute the value of y as a function of x. We utilized a
vector x with 0 to 2 values and set a and b to 2 and 5, respectively. I then computed y using the
z=y2 equation and ww using the short g form. Finally, I used hold on to overlay y and z on the
same axis as functions of xx. The graph demonstrates that z = y squared, as predicted by the
formulas.
2.2 The cubic equation is used to compute freshwater density as a function of temperature. The
temperature vector was transformed to degrees Celsius after spanning from 32 to 93.2
Fahrenheit in 1.3-degree increments. The density vector was calculated using the cubic formula.
The density-temperature connection was demonstrated. The graph depicts how freshwater
density increases with temperature. The cubic formula approximates the density-temperature
relationship, but it is far from perfect.
2.3 We created an Octave program to compute an object's trajectories for beginning angles
ranging from 15 degrees to 75 degrees in 5 degree increments and horizontal lengths ranging
from 0 to 80 meters in 5 meter increments using the mathematical model. A double loop
computes and records the trajectory for each angle and distance in a two-dimensional matrix.
The trajectory of the item is clearly displayed in the matrix for the chosen beginning angles and
horizontal distances. The object moves vertically but not horizontally at smaller beginning
angles. The item goes farther horizontally but lower vertically when the beginning angle is
greater. The longest distance trajectory is 45 degrees.

Exercise 3.
The program calcloan finds the answer for interest and loan math problems. The codes that I
used defined the parameters A,r and P. Created the time-base from n=0 up to n=100. Computed

the unpaid amount remaining using the formula . Used


the stem function by plotting B as a function of n. By using these codes, Octave came up with
the correct answers from the first question of 50,000 pesos with 5% yearly interest to 100,000
pesos with the same interest rate.
The graph shows where the value of n and B becomes zero or negative. That gives off the
number of months to be completed to finish the loan.

Exercise 4
It takes time to accomplish the exercise. there’s a mistake that i’m finding because i can’t
run and there’s no graph. then i check every code and there’s something missing that can’t
complete the codes. after that the program will run successfully.

Exercise 5.
The 'fcalcloan' function accepts four inputs: 'A' for the loan amount, 'P' for the monthly
payment, 'r' for the yearly interest rate, and 'n' for an array of months left on the balance. A 'B'
array containing the remaining loan balance for each month in 'n' is the function's output.
The function first calculates the remaining loan balance using the specified formula, and then
uses the MATLAB 'stem' function to plot the remaining loan balance as a function of remaining
months from balance. The loan balance is shown by the y-axis and the remaining months are
represented by the x-axis. You can use this function by simply calling it with the correct input
arguments, as seen in the example code at the function's end. The method will then return the
remaining loan balance for each month as an array "B," along with a graph showing the data.
Exercise 6.

Two functions, y and z, whose definitions are mathematically described using the trigonometric
and exponential functions, are graphically shown in the first section of the code. The graph
illustrates the relationship between the two functions as a function of x.
In order to determine how temperature influences the density of freshwater, the second section
of the code converts temperature readings from Fahrenheit to Celsius and uses a cubic formula.
The graphic shows the relationship between temperature and density.
The third component of the code determines the trajectory of an object thrown at an angle
theta0 with initial height y0 and beginning velocity v0. The trajectory is calculated for different is
a function of starting angles, x, and is depicted.
The ffreefall function, in general, conducts a range of calculations and produces numerous
charts relating to various physical events.
The independent variable in this model is x, which is the horizontal distance. The parameters
are a, b, y0, v0, g, and theta0, which are all constants used in the calculations of the other
variables.

Exercise 7.
With the domain model T=Ta+(T0Ta)exp(kt) and the format of the function T =
fcooling(t,Ta,T0,k), I was able to solve the exercise's known Newton's Law of Cooling. Through
this practice, we are improving our coding abilities and learning every instruction that we are
learning.

Exercise 8.
The program 'fquadeqn' finds the roots of the quadratic equation ax2+bx+c=0, which can
have real or complex values in the form of 'x1 and x2' with the coefficients a, b, and c. In three
situations, the function works as intended. (1) The equation has no solution and yields "trivial
solution" when "a" and "b" are both zero. (2) If 'a' is equal to 0, the equation is linear and
produces '-c/b'. (3) The function computes the discriminant 'b2 - 4ac', which separates the type
of the roots, when 'a' and 'b' are non-zero. Real roots and the quadratic formula are used when
the discriminant is positive or equal to zero; complex roots and the real and imaginary parts of
the quadratic formula are used when the discriminant is negative.

Exercise 9.
To estimate the value of sine we used the Maclauren formula and modified Taylor series
formula. The number of series should be increased to attain suitable accuracy. In this function, x
is the theta value, and n is the number of series to be employed. The function will provide a
table that displays the solved value based on how many series have been completed, as well as
its relative error to the real number that is pre-programmed in the software's compiler.
References:
(in APA format)
Community, O. (2017, January 2). Function Reference: run.

https://octave.sourceforge.io/octave/function/run.html#:~:text=Scripts%20which%

20reside%20in%20directories,or%20without%20a%20file%20extension.

Download. (n.d.). https://octave.org/download

Octave Programming Tutorial - Wikibooks, open books for an open world. (n.d.).

En.wikibooks.org. Retrieved April 22, 2023, from

https://en.m.wikibooks.org/wiki/Octave_Programming_Tutorial

how to use octav - Google Search. (n.d.). Www.google.com. Retrieved April 22, 2023,

from

https://www.google.com/search?q=how+to+use+octav&oq=how+to+use+octav&a

qs=chrome..69i57j35i39j0i512j0i20i263i512j0i512l5j0i67i650j0i512l5.3352j0j7&cli

ent=ms-android-xiaomi-rvo3&sourceid=chrome-mobile&ie=UTF-8#fpstate=ive&vl

d=cid:5d8a6618

You might also like