1 / 22

PH15010

PH15010. Laboratory Techniques - An Introduction to MATHCAD. Introduction. Indices Range Variables The vectorise operator Summation Reading data files. Addressing Arrays with Indices. Index addressing allows access to individual elements of array Examine & Set elements

Download Presentation

PH15010

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PH15010 Laboratory Techniques - An Introduction to MATHCAD

  2. Introduction • Indices • Range Variables • The vectorise operator • Summation • Reading data files

  3. 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

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

  5. Indices #2Matrix Example • Sample matrix • Examine elements • Subscript too big • Set element • Result

  6. Vectorise Operator #1 • From matrix toolbar • Forces evaluation on element by element basis • Overrides normal matrix maths • ‘dot’ product • Determinant |M| • Powers Mx

  7. Dot product With vectorise operator Vectorise Operator #2

  8. Text Subscript . key Just a name 1 placeholder Array Subscript [ key Index into array 1 placeholder for name + 1 placeholder per index Don’t confuse Text and array subscripts If in doubt, don’t use text subscripts

  9. Range Variables • Take on a series of values • Define using semicolon [;]

  10. Range Variables #2 • Restrictions on where used • ‘illegal context’ error message • Useful for filling arrays

  11. Filling Arrays using RVs • Define RV • Use RV in array index & expression

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

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

  14. Summation #1 • Summation operator on matrix palette • Sum of all elements in a vector

  15. Summation #2 • Operators on Calculus palette • Do summation on any expression • 2 forms • Plain => defines local RV • Range Variable => uses existing RV

  16. Sum of first 5 integers Sum of elements 20-30 of vector Counts Summation #3

  17. 2 terms 4 terms 9 terms Summation #4Reciprocals of factorials

  18. 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)

  19. Reading Data Files #1 • File Read Component • Reads from datafile  array • Text files • Numbers separated by comma or tab • Other formats supported

  20. Reading Data Files #2 • Insert|Component…|File Read or Write • Wizard: • (Select file type) • Browse for file • Finish • Give name for array

  21. Reading Data Files #3 • Example

  22. This weeks worksheet • Arrays & Indices • Columns (Revision) • Submatrix() function • Other array functions • Reading data from file • Analysis of data

More Related