PH15010 - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

PH15010

Description:

Take one or more inputs (parameters) and return a value or values ... Resolving forces etc in 2D, 3D. Co-ordinate transformations. Simultaneous Equations ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 38
Provided by: davelan
Category:
Tags: ordinate | ph15010

less

Transcript and Presenter's Notes

Title: PH15010


1
PH15010
  • Laboratory Techniques -
  • An Introduction to MATHCAD

2
Introduction
  • Review of last week
  • Vector and Matrix Maths
  • Statistics
  • Solving simultaneous equations with matrices

3
Review of Last Week
  • Processing experimental data with arrays
  • Adding Error bars to graphs
  • Pre-Processing Data
  • Convert l to f
  • Logarithms for power law
  • Extract slope intercept from data

4
Functions Reviewed
  • Take one or more inputs (parameters) and return a
    value or values
  • From f(x) toolbar if you dont know the name
  • Afunction(parameters)
  • AvariableAfunction(p1,p2,p3)
  • Use the help system/f(x) dialog

5
Matrix Vector Maths
  • Used for
  • Processing experimental data
  • Statistics
  • Resolving forces etc in 2D, 3D
  • Co-ordinate transformations
  • Simultaneous Equations
  • Applying transforms to data

6
Creating Arrays in MathCAD
  • 2 ways of entering arrays
  • Input Table (already encountered)
  • Spreadsheet type entry
  • Expand to fit data available
  • Insert Matrix Dialog box
  • Array of placeholders
  • Good if you know how many elements in
    matrix/vector

7
Creating an array with InsertMatrix
  • Same for defining ordinary variable
  • Follow with
  • from toolbar
  • ltctrl-mgt
  • InsertMatrix
  • Dialog box for rows columns

8
Creating arrays with InsertMatrix
9
Matrix Maths 1
10
Matrix Maths 2(Symbolically)
  • Matrix Multiplication
  • Determinant
  • Addition of constant

11
Matrix Vector Maths
  • Add, Multiply Divide matrices/vectors
  • Must have correct numbers of rows columns

12
Addressing Arrays with Indices
  • Index addressing allows access to individual
    elements of array
  • Examine Set elements
  • Indices start at 0
  • Indices use key
  • 2D matrices use two indices for row, column
    selection

13
Indices 1 Vector Example
  • Simple 2 element vector
  • Examine elements
  • Set element 0
  • Result of setting

14
Indices 2Matrix Example
  • Sample matrix
  • Examine elements
  • Subscript too big
  • Set element
  • Result

15
Accessing Parts Of Arrays
  • Index addressing single element ?
  • Column Extract operator Mltgt ?
  • Submatrix() function
  • Transposing matrices

16
The submatrix() function
Define a matrix
Use submatrix() to extract part of the array
17
Transpose Rows Columns
  • Uses MT operator
  • From matrix toolbar

18
Other matrix functions1. Information
  • Return information about
  • Size of matrix
  • rows(M), cols(M), last(V), length(V)
  • Contents of matrix
  • min(A), max(A)
  • ?V

19
Other matrix functions2. Manipulation
  • Create new arrays
  • Put 2 arrays together
  • stack(A1,A2)
  • augment(A1,A2)
  • Sorting
  • sort(V), reverse(A)
  • rsort(M,r), csort(M,c)

20
Statistical Functionson Vectors 1
  • From f(x) dialog box under Statistics
  • Averaging
  • mean() Average value
  • median() Half way item
  • mode() Most common value

21
Statistical Functionson Vectors 2
  • Variance Standard Deviation
  • 2 forms of each
  • Analysis of sample
  • Stdev(), Var()
  • Analysis of whole population
  • stdev(), var()
  • Note capitalisation

22
Vectorise Operator 1
  • From matrix toolbar
  • Forces evaluation on element by element basis
  • Overrides normal matrix maths
  • dot product
  • Determinant M
  • Powers Mx

23
Vectorise Operator 2
  • Dot product
  • With vectorise operator

24
Range Variables
  • Take on a series of values
  • Define using semicolon

25
Range Variables 2
  • Restrictions on where used
  • illegal context error message
  • Useful for filling arrays

26
Filling Arrays using RVs
  • Define RV
  • Use RV in array index expression

27
Processing Arrays using RVs
  • Use RV in expressions to create output array from
    input array

28
Range Variables with different step sizes
  • Can create RVs with different step sizes.
  • Enter first 2 values separated by comma ,
    before typing

29
Summation 1
  • Summation operator on matrix palette
  • Sum of all elements in a vector

30
Summation 2
  • Operators on Calculus palette
  • Do summation on any expression
  • 2 forms
  • Plain gt defines local RV
  • Range Variable gt uses existing RV

31
Summation 3
  • Sum of first 5 integers
  • Sum of elements 20-30 of vector Counts

32
Summation 4Reciprocals of factorials
  • 2 terms
  • 4 terms
  • 9 terms

33
Data Files
  • Used Input table to put data into MathCAD by
    hand.
  • Can use Import on input table to get from a file
    (makes a copy)
  • Select table right-click
  • Also can link to data file with File Read
    Component (preferred)

34
Reading Data Files 1
  • File Read Component
  • Reads from datafile ? array
  • Text files
  • Numbers separated by comma or tab
  • Other formats supported

35
Reading Data Files 2
  • InsertComponentFile Read or Write
  • Wizard
  • (Select file type)
  • Browse for file
  • Finish
  • Give name for array

36
Reading Data Files 3
  • Example

37
This weeks worksheet
  • Arrays Indices
  • Columns (Revision)
  • Submatrix() function
  • Other array functions
  • Reading data from file
Write a Comment
User Comments (0)
About PowerShow.com