MATLAB Basics - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

MATLAB Basics

Description:

every command generates a result which is shown in the Command Window after the instruction ... the workspace can be emptied by issuing the clear command ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 27
Provided by: Walt90
Category:
Tags: matlab | basics | emptied

less

Transcript and Presenter's Notes

Title: MATLAB Basics


1
MATLAB Basics
2
  • Workspace
  • variable list
  • includes size and type

Command window
Command history
3
  • instructions or commands are typed directly into
    the Command Window
  • every command generates a result which is shown
    in the Command Window after the instruction
  • a value of 3 has been assigned to variable a
  • numeric variables are stored in arrays
  • Workspace Window indicates that the variable a is
    a 1x1 matrix holding a double precision value
    which requires 8 bytes of storage.
  • note that the assignment command was recorded in
    the Command History Window

4
  • each command is executed as it is entered
  • value of 4 is assigned to variable b
  • sum of the values assigned to a and b is assigned
    to variable c and result is immediately displayed
  • if the result of a command is not assigned to a
    named variable, then the result is assigned to
    the default variable ans
  • workspace now contains 4 variables
  • line spacing in the Command Window can be reduced
    by setting the format to compact
  • the Command Window will scroll automatically or
    it can be completely cleared by issuing the clc
    command

5
  • the workspace can be emptied by issuing the clear
    command

6
  • these commands produce the calculated volume of a
    cylindrical tank, d 3 ft, h 4 ft
  • note that the value for pi is predefined
  • the resolution of calculated results can be
    changed by using the commands format long and
    format short
  • note that variable names are case sensitive,
    i.e., a and A are two different variables that
    stored separately in the workspace

7
Tank Filling
8
  • A sequence of Matlab commands is stored in an
    m-File

9
  • mass flow rate through each of the tank openings
    is calculated as
  • pi is a built-in variable

10
  • Create a new directory in your My Documents
    folder or on your TechDrive
  • Save the file as tank.m
  • .m is the standard extension for Matlab program
    files

11
  • set the current directory to the Matlab work
    directory that you just saved the m-file into
  • type the program and file name tank
  • notice that each command generates output and
    that it is spread out too far

12
  • placing a semi-colon at the end of a line
    suppresses output from that line
  • include a format compact statement to tighten
    the output
  • notice the in the window title bar to
    indicate that the file has been modified since
    the last save

13
(No Transcript)
14
Comments are inserted anywhere by typing a
character
15
  • the program has an undefined variable error
  • click on the link to go to the file with the error

16
the variable name mdot1 was misspelled
17
Tank Filling
18
Tank Filling
19
Tank Filling
20
Tank Filling
21
Tank Filling
22
Beam Support Forces
  • For static equilibrium
  • the sum of the forces acting on the beam must be
    zero, and
  • the sum of the moments about any point on the
    beam must be zero.

23
Beam Support Forces
24
Beam Support Forces
25
Beam Support Forces
26
Beam Support Forces
Write a Comment
User Comments (0)
About PowerShow.com