


Laboratory Techniques  

An Introduction to MATHCAD 




‘Quickplot’ 

Plot functions with 1 parameter 

Use with builtin & user defined 

InsertGraphXY plot 







Double click in graph 

FormatGraphXY Plot… 

Dialog box 

Gridlines, Numbered Axes, Log Scales 

Traces: Colour, Points, Lines &c 

Axis titles, legend 

Defaults 




Add more curves to yaxis 

Fix scale on x & yaxis 

Add markers on x & yaxis
 from dialog box 









5 stage process 

Get data into MathCAD 

Process data (scale, units etc) 

Plot Data 

Fit curve (line) to data 

Compare theory with experiment 





Put data in matrix 

1 column per measurement 

1 row per data point 

Use Input Table 

InsertComponentInput
Table 

Table resizes & scrolls as needed 




Resistor Experiment 

Apply voltage, measure Current 






Extract columns with column operator M^{<>} 

Insert into worksheet from 

Matrix toolbar 

<ctrl>6 

Fill in column number to extract 

Numbering starts at 0 





Single column 

Converted to base units 

Scroll bars if needed 




XY Plot can plot 1 vector against another, if
both vectors have same number of elements 

Use plot formatting to change to single points 








Only simple straight line fits for now 

slope(Vx,Vy) 

intercept(Vx,Vy) 

Details in help system 

Units carry through calculation 

Sometimes need 1/slope 





Create function 

Plot on same graph as experimental data 

Use multiple variables on x and y axes 

Separate items on axes with commas 




Function gives theoretical current 



Test function at a couple of points 





Add to graph to show uncertainty in y values. 

Create vector of ‘High’ values 

Create vector of ‘Low’ values 

Add as traces to yaxis 

Add extra xaxis variables 

Format as error bars 




Use vector maths to get ‘high’ and ‘low’ vectors 






Use vector maths to preprocess data before
graphing 

Use knowledge of physics to get data into a
straight line format 





2 Examples given: 

Photoelectric effect 

Convert vector of wavelengths to frequencies 

Power Law 

Take logs of vector 






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 





File Read Component 

Reads from datafile è array 

Text files 

Numbers separated by comma or tab 

Other formats supported 





if(condition,Tval,Fval) 

condition evaluated 

True (¹0) è returns Tval 

False (=0) è returns Fval 





From evaluation palette 

= (bold, logical equals) <ctrl => 

> greater than 

< less than 

³ greater than or equal to 

£ less than or equal to 





False = 0 

True = 1 (or ¹0) 

Use multiplication for AND 

Use addition for OR 

(x>5)•(x<8) 

True if x>5 and x<8 

(x<3)+(x>16) 

True if x<3 or x>16 




Handled same as other numbers 

Full range of complex maths 

Put i (or j) directly after complex number 

Enter i as 1i 

Use x to get modulus 

Use arg() to get argument 

Avoid using i as variable when using complex
numbers 





Manipulate equations rather than numbers 

Symbolic Palette 

Evaluate
® 

Simplify simplify ® 

Expand expand,n ® 

Substitute substitute, n= n ® 

Solve solve, n ® 




From example sheet  solve using mathCAD 

A manufacturer of tin cans wishes to maximise
the volume contained in a can, whilst minimising the amount of metal used
to construct the can. Show that, for given amount of metal, the volume of a
can is maximised when the radius is half the height. 




Need to find when dVol/dr=0 

Write down expressions for Volume & Area 

Use bold, logical equals sign 




Copy & Paste expression for Area & solve
for h 




Copy & paste expression for Vol 

Substitute expression for h 




Use symbolic differentiation to find dVol/dr 









This will be 0 at maximum 




Solve for dVol/dr = 0 to find r 











2 solutions, copy +ve 

