{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Statics Notes Day 3

# Statics Notes Day 3 - Introduction to MATLAB Learning...

This preview shows pages 1–12. Sign up to view the full content.

Introduction to MATLAB

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Learning Objectives familiarity with: MATLAB operations Simple Plotting MATLAB functions, scripts Vectors, Matrices Symbolic Calculations
Here is what the MATLAB screen looks like when you start up.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
If we generate a vector in the command window it shows up in the workspace window and command history WORKSPACE COMMAND HISTORY
we can see the files in the current directory

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MATLAB Editor for generating functions, scripts we can bring up an editor window for making new functions or scripts
example of generating a plot

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MATLAB Built in constants and variables ans most recent answer eps small constant ~ 10 -16 i or j imaginary unit inf infinity pi 3.14159 ... Standard mathematical operations ± addition, subtraction * multiplication / division ^ exponentiation e.g. y n = y^n Some common functions sin(x) sine cos(x) cosine exp(x) exponential sqrt(x) square root log(x) natural log log10(x) log to base 10 abs(x) absolute value, magnitude of complex quantity angle(x) phase angle real(x) real part of imag(x) imaginary part of
Generation of (row) vectors >> x = 0:0.1:0.5 x = 0 0.1000 0.2000 0.3000 0.4000 0.5000 >> y =linspace(0, 0.5, 4) y = 0 0.1667 0.3333 0.5000 >> z = [ 1 2 3 4 5] z = 1 2 3 4 5 Suppression of echoing of output (put semi-colon at end of line) >> z = [ 1 2 3 4 5] ; >> >> z z = 1 2 3 4 5 Comment line >> % This is a comment >>

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Vectors in Statics are often 3-D vectors >> Force1 =[ 100 200 300]; >> position = [2, 3, 4]; >> Force2 = [50 100 100]; >> Force1 + Force2 ans = 150 300 400 >> dot(Force1, Force2) ans = 55000 >> cross(position, Force1) ans = 100 -200 100 sum of forces dot product of two force vectors cross product of a position vector with a force vector (requires vectors to be 3-D) 2-D vectors can still be represented as 3-D vectors by adding in a zero in the third dimension >> Force2D = [20 30 0]; >> position2D = [2 4 0]; >> cross(position2D, Force2D) ans = 0 0 -20
Functions can have vector (matrix) arguments >> x = [ 1 2 3 4 5]; >> y = exp(x) y = 2.7183 7.3891 20.0855 54.5982 148.4132 Element by element operations on vector-valued functions ±

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}