Download presentation
Presentation is loading. Please wait.
Published byAntony Carter Modified over 9 years ago
1
PH24010 Data Handling and Statistics Use of MathCAD to handle statistical data Data storage in vectors and matrices MathCAD’s built-in functions: –Mean, standard deviation etc –Probability distributions Extending MathCAD through defining functions and programming Revision of PH1570
2
Arrays, Matrices & Vectors Way of storing related data –Experimental Results (datasets) –Coefficients One variable name, many data points Indexing –var 0, var 1, var 2, var 3 …
3
Arrays, Vectors & Matrices - Terminology Vector – 1-dimensional Matrix – 2-dimensional Array – general term, covers both
4
MathCAD and arrays Matrix toolbar has tools to: –Create and –Operate on matrices Many functions f(x) operate on matrices
5
Creating an array Same for defining ordinary variable Follow : with –[:::] from toolbar or – or –Insert|Matrix Dialog box for rows & columns
6
Creating arrays 3 –element vector – empty Placeholders to fill in Can use units
7
Data Tables Define array and input data in one operation Re-sizes to fit data From Insert|Data|Table
8
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
9
Indices #1 Vector Example Simple 2 element vector Examine elements Set element 0 Result of setting
10
Indices #2 Matrix Example Sample matrix Examine elements Subscript too big Set element Result
11
Statistical Functions on Vectors #1 From f(x) dialog box under “Statistics” Averaging –mean() ‘Average value’ –median() ‘Half way item’ –mode() ‘Most common value’
12
Statistical Functions on Vectors #2 Variance & Standard Deviation 2 forms of each Analysis of sample –Stdev(), Var() Analysis of whole population –stdev(), var() Note capitalisation
13
Summation #1 Summation operator on matrix palette Sum of all elements in a vector
14
Summation #2 Operators on Calculus palette Do summation on any expression 2 forms –Plain => defines local RV –Range Variable => uses existing RV
15
Summation #3 Sum of first 5 integers Sum of elements 20- 30 of vector Counts
16
Writing Programs in MathCAD Can do much without programming Some algorithms need programs –Iterative, repeat until solution Can make other tasks simpler Hide detail inside a program
17
The Golden Rule of Programming Applies to all programming K.I.S.S. principle –Keep –It–It –Simple –Stupid
18
A MathCAD program All MathCAD programs are functions Expression over multiple lines Lines executed in order Local Variables Value of last line is result
19
A simple MathCAD program #1 Common subexpression calculated 3 times in function Can re-write using a program
20
fExample(a,b) as a 2 line program 1 st line calculates sqrt & assigns to local variable ‘r’ 2 nd line calculates expression & returns answer
21
MathCAD Programs #1 Programming Palette from toolbar Select keywords from palette, DO NOT TYPE Add Line to add lines to program Watch selection box, carefully
22
MathCAD Programs #2 Assignments are local to program Assignments in program use Can use full range of MathCAD functions in program Last line is result of program Use Vectors & Arrays to return multiple results
23
MathCAD Programs Online Help Tutorials –Getting started Defining functions –Features In-Depth Programming Quicksheets –Programming
24
Review of Lecture
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.