Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MATLAB 7.0 Basics
#1

MATLAB 7.0 Basics

[attachment=17632]
Introduction
MATLAB, which stands for MATrix LABoratory, is a software package developed by MathWorks, Inc. to
facillitate numerical computations as well as some symbolic manipulation.1 It strikes me as being slightly
more di cult to begin working with than such packages as Maple, Mathematica, and Macsyma, though
once you get comfortable with it, it o ers greater flexibility. The main point of using it in M442 is that it
is currently the package you will most likely nd yourself working with if you get a job in engineering or
industrial mathematics.2

Starting MATLAB at Texas A&M University
You should have a calclab account assigned to you for M442 (I'll pass these out on the rst day of class, or
as soon as I get them). Log in and click on the six pointed geometric gure in the bottom left corner of your
1The collection of programs (primarily in Fortran) that eventually became MATLAB were developed in the late 1970s by
Cleve Moler, who used them in a numerical analysis course he was teaching at the University of New Mexico. Jack Little
and Steve Bangert later reprogrammed these routines in C, and added M- les, toolboxes, and more powerful graphics (original
versions created plots by printing asterisks on the screen). Moler, Little, and Bangert founded MathWorks in California in
1984.

Simple Computations with MATLAB
3.1 What you're looking at
The (default) MATLAB screen is divided into three windows, with a large Command Window on the
right, and two smaller windows stacked one atop the other on the left. The Command Window is where
calculations are carried out in MATLAB, while the smaller windows display information about your current
MATLAB session, your previous MATLAB sessions, and your computer account. Your options for these
smaller windows are Command History, which displays the commands you've typed in from both the current
and previous sessions, Current Directory, which shows which directory you're currently in and what les are
in that directory, and Workspace, which displays information about each variable de ned in your current
session. You can choose which of these options you would like to have displayed by selecting Desktop from
the main MATLAB window. Occasionally, it will be important that you are working in a certain directory.
Introduction to MATLAB

[attachment=17633]

MATLAB s Workspace

who,whos - current variables in workspace
save - save workspace variables to *.mat file
load - load variables from *.mat file
clear all - clear workspace variables

Basic Operations on Matrices
All the operators in MATLAB defined on
matrices : +, -, *, /, ^, sqrt, sin, cos etc.
Element wise operators defined with
preceding dot : .*, ./, .^ .
size(A) - size vector
sum(A) - columns sums vector
sum(sum(A)) - all the elements sum

MATLAB has five flow control constructs:
if statements
switch statements
for loops
while loops
break statements
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.