0% found this document useful (0 votes)
26 views9 pages

0 NS Topic 2

This document introduces MATLAB as a powerful tool for numerical calculations and programming, emphasizing hands-on practice with commands in an interactive environment. It outlines MATLAB's features, such as its high-level language capabilities, built-in graphics, and extensive mathematical functions, while also detailing its applications in various scientific and engineering fields. The document concludes with basic syntax rules for variable naming and saving work within MATLAB.

Uploaded by

Gielyn Cacas
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)
26 views9 pages

0 NS Topic 2

This document introduces MATLAB as a powerful tool for numerical calculations and programming, emphasizing hands-on practice with commands in an interactive environment. It outlines MATLAB's features, such as its high-level language capabilities, built-in graphics, and extensive mathematical functions, while also detailing its applications in various scientific and engineering fields. The document concludes with basic syntax rules for variable naming and saving work within MATLAB.

Uploaded by

Gielyn Cacas
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

2.

FUNDAMENTALS OF COMPUTER AIDED MATHEMATICAL CALCULATIONS

Introduction
MATLAB is a computer program that provides the user with a convenient environment for performing
many types of calculations. In particular, it provides a very nice tool to implement numerical methods. The most
common way to operate MATLAB is by entering commands one at a time in the command window. In this chapter,
we use this interactive or calculator mode to introduce you to common operations such as performing calculations
and creating plots. In this unit we show how such commands can be used to create MATLAB programs. One
further note. This chapter has been written as a hands-on exercise. That is, you should read it while sitting in front
of your computer. The most efficient way to become proficient is to actually implement the commands on MATLAB
as you proceed through the following material.

Motivation
In this lesson, you’re going to learn how to talk to MATLAB using simple commands. It’s a bit like giving
instructions to a robot by typing them out. For example, you could ask it to add numbers like "1 + 1" or make a
graph that shows how high a ball bounces over time. And the best part? You get to see the answers right away!
To really get good at using MATLAB: Try the commands while you are reading about them. Kind of like playing a
video game, the more you practice, the better you get. So don't just read, play around with it and see what happens!
Soon, you will be writing your own cool programs, solving all kinds of fun challenges, and so on.

Specific Learning Outcomes


At the end of the topic, the students should be able to:
Identify the basics of numerical computations and use software tools for basic mathematical calculations.

Concepts

Features of MATLAB Following are the basic features of MATLAB:


a) It is a high-level language for numerical computation, visualization and application development.
b) It also provides an interactive environment for iterative exploration, design and problem solving.
c) It provides vast library of mathematical functions for linear algebra, statistics, Fourier analysis, filtering,
optimization, numerical integration and solving ordinary differential equations.
d) It provides built-in graphics for visualizing data and tools for creating custom plots.
e) MATLAB's programming interface gives development tools for improving code quality, maintainability,
and maximizing performance.
f) It provides tools for building applications with custom graphical interfaces.
g) It provides functions for integrating MATLAB based algorithms with external applications and languages
such as C, Java, .NET and Microsoft Excel.

Uses of MATLAB
MATLAB is widely used as a computational tool in science and engineering encompassing the fields of
physics, chemistry, math and all engineering streams. It is used in a range of applications including:
a) signal processing and Communications
b) image and video Processing
c) control systems
d) test and measurement
e) computational finance
f) computational biology

Understanding the MATLAB Environment


MATLAB uses three primary windows:
1. Command window. Used to enter commands and data.
2. Graphics window. Used to display plots and graphs.
3. Edit window. Used to create and edit M-files.

1
After starting MATLAB, the command window will open with the command prompt being displayed

>>

The calculator mode of MATLAB operates in a sequential fashion as you type in commands line by line. For
each command, you get a result. Thus, you can think of it as operating like a very fancy calculator. For example,
if you type in

>> 58 - 20

MATLAB will display the result

ans =
38

Notice that MATLAB has automatically assigned the answer to a variable, ans. Thus, you could now use ans
in a subsequent calculation:

>> ans + 18

with the result

ans =
56

MATLAB assigns the result to ans whenever you do not explicitly assign the calculation to a variable of your
own choosing.

Basic Syntax

2
3
4
Naming Variables
Variable names consist of a letter followed by any number of letters, digits or underscore.
MATLAB is case-sensitive.
Variable names can be of any length, however, MATLAB uses only first N characters, where N is given
by the function namelengthmax.

How to save your work?


The save command is used for saving all the variables in the workspace, as a file with .mat extension, in
the current directory. For example,

You can reload the file anytime later using the load command.

5
6
7
8
ACTIVITY SHEET NO. 2 Topic: ________________________________________________

SUBJECT: CE 323 - Numerical Solutions to CE Problems DATE SUBMITTED: _____________________

Name: ______________________________________________ Program/ Year/ Section _________________

Instructor’s Name: __________________________________________________ Score: _________________

Write the command for the following expressions:

1. 1 + 1

2. 8 x -0.5

3. sin (π/2)

4. y = x2 + 9; x = 3

You might also like