You are on page 1of 8

De La Salle University Dasmarias

College of Engineering, Architecture and Technology


Engineering Department
Electronics Engineering Program

EEET412L Numerical Methods Lab


M / 1430 1730
CTH 110

Activity
MATLAB as Calculator

Submitted by:
Barcelona, Keanu Chris
Pugay, Marl Rendell E.

ECE41
September 29, 2014

Leonila T. Elemento, CpE


Instructor

I. OBJECTIVES:
1. To understand the functions and purpose of MATLAB software and to comprehend its
relevance to calculator
2. To know how to enter numbers, use variables, do arithmetic and use scientific functions.
3. To implement the application of MATLAB as a function of calculator through various
problems with relation to basic analytic geometry and principle of communication.
II. ABSTRACT:
This experiment, MATLAB as Calculator, intends to understand the functions and
purpose of MATLAB software and to comprehend its relevance to calculator and to solve
equations using MATLAB as calculator with relation to basic principle of communication and
analytic geometry. Here, the application of MATLAB as calculator was used to determine
resonant frequency, bandwidth and conversion of temperature. Also, problems required include
finding the area and circumference of a circle for a desired value of radius (r); and to find the
volume of sphere with certain requirements.
III. DISCUSSION:
As it was defined, MATLAB is an interactive, high-level, user-friendly programming and
visualization environment. It allows much faster program development in comparison with the
traditional low-level compiled languages like FORTRAN or C. Comparing it to Microsoft Excel,
MATLAB has an easier way to set up methods, formula and assigning variables. MATLAB
performs basic arithmetic operations with the given symbols; Addition (+), Subtraction (-),
Multiplication (*), Division (/), and Exponentiation (^) on integers.

As for putting up a

comment, a symbol (%) is used and the program ignores everything to the right of this symbol.
In the experiment, MATLAB was performed through various kinds of problems which
can possibly solve by using the scientific calculator. There are two examples of problem set. The
first example has a relation to the basic principle of communication which requires the data of
the resonant frequency as variable (fr), bandwidth as variable (BW) and the conversion of
temperatures such as Celsius-Kelvin as variable (c-k), Celsius-Fahrenheit as variable (c-f) and
Fahrenheit-Celsius as variable (f-c). The second example is about the basic algebra or analytic
geometry which requires finding the area and circumference of a circle for a desired value of
radius (r); and to find the volume of sphere with certain requirements.

IV. PROCEDURE:
EXAMPLE I = PRINCIPLE OF COMMUNICATION
1.
2.
3.
4.

In windows, go to Start menu and select MATLAB then patiently wait for it to start.
As the program opens, click the New Script.
Create the script (as to what name is desired) and start constructing the codes.
To start, type the following on the editor window:
%MATLAB as Calculator
%Resonant Frquency
disp('Resonant Frquency')
L=input('Inductance [L]: ')
C=input('Capacitance [C]: ')
Q=input('Quality Factor [Q]: ')
fr=1/((2*pi)*sqrt(L*C));
BW=fr/Q;
disp('fr= ');
disp(fr);
disp('BW= ');
disp(BW);
%Conversion of Temperatures
disp('Conversion of Temperatures')
c=input('Celcius [c]: ')
k=input('Kelvin [k]: ')
f=input('Farenheit [f]: ')
ck=c+273 %celcius to kelvin
cf=((9/5)*c)+32 %celcius to farenheit
fc=((5/9)*(f-32)) %farenheit to celcius
disp('c-k= ');
disp(ck);
disp('c-f= ');
disp(cf);
disp('f-c');
disp(fc);

5. Run the program by clicking the run button above.


6. Debug for errors.

EXAMPLE II = AREA AND CIRCUMFERENCE OF A CIRCLE

1.
2.
3.
4.

In windows, go to Start menu and select MATLAB then patiently wait for it to start.
As the program opens, click the New Script.
Create the script (as to what name is desired) and start constructing the codes.
To start, type the following on the editor window:
%MATLAB AS CALCULATOR: AREA AND CIRCUMFERENCE
clc
r=input('r=
A=pi*r^2;
C=2*pi*r^2;

');

disp('Area=')
disp(A)
disp('Circumference=')
disp(C)

5. Run the program by clicking the run button above.


6. Debug for errors.

VOLUME OF THE SPHERE


1.
2.
3.
4.

In windows, go to Start menu and select MATLAB then patiently wait for it to start.
As the program opens, click the New Script.
Create the script (as to what name is desired) and start constructing the codes.
To start, type the following on the editor window:

%MATLAB AS CaALCULATOR: VOLUME OF SPHERE


clc
r=(18/((4/3)*pi))^(1/3)
NewVolume=(4/3)*pi*(4*r)^3

5. Run the program by clicking the run button above.


6. Debug for errors.

V. DATA AND RESULTS


EXAMPLE I
PRINCIPLE OF COMMUNICATION

(Script)

PRINCIPLE OF COMMUNICATION
(Command Window)

EXAMPLE II
AREA AND CIRCUMFERENCE
(Script)

AREA AND CIRCUMFERENCE


(Command Window)

VOLUME OF SPHERE
(Script)

VOLUME OF SPHERE
(Command Window)

VI. CONCLUSION
After conducting the experiment, the students were able to understand the functions
and purpose of MATLAB software and to comprehend its relevance to calculator, and to
know how to enter numbers, how to use variables, how to do arithmetic and use scientific
functions. The data gathered shows that using this program for calculation is less time
consuming. This helps the student to analyze more of the mathematical problems and
enhance their critical thinking. All results are based depending on the user. Here, the values
for resonant frequency, bandwidth, and conversion of temperature such as Celsius,
Fahrenheit, and Kelvin were acquired through the constructing the equations for a given data.
In addition to this, the values for the area and circumference of the circle as well as the
volume of the sphere were acquired correctly. The data gathered was successfully acquired
and so, it can be concluded that the objectives of the experiment were successfully attained.

You might also like