.MCAD 304020000 1 74 19 0 .CMD PLOTFORMAT 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 1 NO-TRACE-STRING 0 2 1 0 1 1 NO-TRACE-STRING 0 3 2 0 1 1 NO-TRACE-STRING 0 4 3 0 1 1 NO-TRACE-STRING 0 1 4 0 1 1 NO-TRACE-STRING 0 2 5 0 1 1 NO-TRACE-STRING 0 3 6 0 1 1 NO-TRACE-STRING 0 4 0 0 1 1 NO-TRACE-STRING 0 1 1 0 1 1 NO-TRACE-STRING 0 2 2 0 1 1 NO-TRACE-STRING 0 3 3 0 1 1 NO-TRACE-STRING 0 4 4 0 1 1 NO-TRACE-STRING 0 1 5 0 1 1 NO-TRACE-STRING 0 2 6 0 1 1 NO-TRACE-STRING 0 3 0 0 1 1 NO-TRACE-STRING 0 4 1 0 1 1 NO-TRACE-STRING 0 1 1 21 15 0 0 3 .CMD FORMAT rd=d ct=10 im=i et=3 zt=15 pr=3 mass length time charge temperature tr=0 vm=0 .CMD SET ORIGIN 0 .CMD SET TOL 0.001000000000000 .CMD SET PRNCOLWIDTH 8 .CMD SET PRNPRECISION 4 .CMD PRINT_SETUP 1.200000 1.218750 1.200000 1.200000 0 .CMD HEADER_FOOTER 1 1 *empty* *empty* *empty* 0 1 *empty* *empty* *empty* .CMD HEADER_FOOTER_FONT fontID=14 family=Arial points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD HEADER_FOOTER_FONT fontID=15 family=Arial points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFAULT_TEXT_PARPROPS 0 0 0 .CMD DEFINE_FONTSTYLE_NAME fontID=0 name=Variables .CMD DEFINE_FONTSTYLE_NAME fontID=1 name=Constants .CMD DEFINE_FONTSTYLE_NAME fontID=2 name=Text .CMD DEFINE_FONTSTYLE_NAME fontID=4 name=User^1 .CMD DEFINE_FONTSTYLE_NAME fontID=5 name=User^2 .CMD DEFINE_FONTSTYLE_NAME fontID=6 name=User^3 .CMD DEFINE_FONTSTYLE_NAME fontID=7 name=User^4 .CMD DEFINE_FONTSTYLE_NAME fontID=8 name=User^5 .CMD DEFINE_FONTSTYLE_NAME fontID=9 name=User^6 .CMD DEFINE_FONTSTYLE_NAME fontID=10 name=User^7 .CMD DEFINE_FONTSTYLE fontID=0 family=Times^New^Roman points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=1 family=Times^New^Roman points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=2 family=Arial points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=4 family=Arial points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=5 family=Courier^New points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=6 family=System points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=7 family=Script points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=8 family=Roman points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=9 family=Modern points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD DEFINE_FONTSTYLE fontID=10 family=Times^New^Roman points=10 bold=0 italic=0 underline=0 colrid=-1 .CMD UNITS U=1 .CMD DIMENSIONS_ANALYSIS 0 0 .CMD COLORTAB_ENTRY 0 0 0 .CMD COLORTAB_ENTRY 128 0 0 .CMD COLORTAB_ENTRY 0 128 0 .CMD COLORTAB_ENTRY 128 128 0 .CMD COLORTAB_ENTRY 0 0 128 .CMD COLORTAB_ENTRY 128 0 128 .CMD COLORTAB_ENTRY 0 128 128 .CMD COLORTAB_ENTRY 128 128 128 .CMD COLORTAB_ENTRY 192 192 192 .CMD COLORTAB_ENTRY 255 0 0 .CMD COLORTAB_ENTRY 0 255 0 .CMD COLORTAB_ENTRY 255 255 0 .CMD COLORTAB_ENTRY 0 0 255 .CMD COLORTAB_ENTRY 255 0 255 .CMD COLORTAB_ENTRY 0 255 255 .CMD COLORTAB_ENTRY 255 255 255 .TXT 4 11 3 0 0 Cg a73.000000,73.000000,39 {\rtf\ansi \deff0{\colortbl;\red0\green128\blue128;}{\fonttbl{\f0 \fcharset0\fnil Arial;}}\plain\cf1\fs20 \pard {\fs32\b Interpolating Tabular Data with Mathcad}} .TXT 5 -10 5 0 0 Cg a73.000000,73.000000,688 {\rtf\ansi \deff0{\colortbl;\red0\green128\blue128;}{\fonttbl{\f0 \fcharset0\fnil Arial;}}\plain\cf1\fs20 \pard We are frequently required to interpolate tabular data; for example, the VLE data in HWK #4 was given in tabular form. Another example is need to interpolate the steam table. One (old fashioned) method of interpolation is to plot the data and draw a smooth curve through the points. Less accurate is to linearly interpolate. \par \par In this module, we will show how to make Mathcad do the interpolation for us. It turns out that Mathcad can perform "cubic spline" interpolations to convert columns of x-y data into continuous functions that can be used as y = f(x) or x = g(y)\par \par As an example, we will take the tabular data from HWK #4, Prob. 4 and perform the cubic-spline interpolation. } .TXT 24 24 11 0 0 Cg a49.000000,49.000000,363 {\rtf\ansi \deff0{\colortbl;\red0\green128\blue128;}{\fonttbl{\f0 \fcharset0\fnil Arial;}}\plain\cf1\fs20 \pard The first step is to enter the columns of data. The end result is shown at left. To get a column vector of placeholders to appear after the ":=", just type Ctrl-M or use the Math/Matrices menu. This brings up a dialog box where you can enter the number of columns and rows (we used 1 column and 8 rows). We then manually typed the numbers in each placeholder.} .EQN 10 -23 8 0 0 {0:xs}NAME:({8,1}ö1ö.9ö.7ö.55ö.5ö.3ö.1ö0) .EQN 0 9 9 0 0 {0:ys}NAME:({8,1}ö1ö.989ö.95ö.9ö.875ö.7ö.36ö0) .EQN 15 -10 13 0 0 {0:f}NAME({0:x}NAME):{0:interp}NAME({0:pspline}NAME({0:xs}NAME,{0:ys}NAME),{0:xs}NAME,{0:ys}NAME,{0:x}NAME) .TXT 0 30 14 0 0 Cg a43.000000,43.000000,132 {\rtf\ansi \deff0{\colortbl;\red0\green128\blue128;}{\fonttbl{\f0 \fcharset0\fnil Arial;}}\plain\cf1\fs20 \pard In this statement, we define a function f(x) that for a given value of x, interpolates the table for the corresponding value of y. } .TXT 7 -30 15 0 0 Cg a73.000000,73.000000,360 {\rtf\ansi \deff0{\colortbl;\red0\green128\blue128;}{\fonttbl{\f0 \fcharset0\fnil Arial;}{\f1\fcharset0\fnil Times New Roman;}}\plain\cf1 \fs20 \pard This definition uses two built-in Mathcad functions: "interp" and "pspline". In place of "pspline" you might substitute "lspline" or "cspline". "pspline", "lspline" and "cspline" perform parabolic-, linear- or cubic-spline interpolations, respectively. All of these functions are available (along with some documentation) using the {\f1\b\i f(x)} tool on the toolbar.} .EQN 10 10 16 0 0 {0:i}NAME:0;{0:last}NAME({0:ys}NAME) .EQN 4 0 17 0 0 {0:x}NAME:0,.02;1 .EQN 2 -11 18 0 0 &&(_n_u_l_l_&_n_u_l_l_)&{0:f}NAME({0:x}NAME),{0:x}NAME,({0:ys}NAME)[({0:i}NAME)@&&(_n_u_l_l_&_n_u_l_l_)&{0:x}NAME,{0:x}NAME,({0:xs}NAME)[({0:i}NAME) 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 2 1 0 0 1 1 NO-TRACE-STRING 0 1 6 0 1 1 NO-TRACE-STRING 3 0 6 0 1 1 NO-TRACE-STRING 0 4 6 0 1 1 NO-TRACE-STRING 0 1 4 0 1 1 NO-TRACE-STRING 0 2 5 0 1 1 NO-TRACE-STRING 0 3 6 0 1 1 NO-TRACE-STRING 0 4 0 0 1 1 NO-TRACE-STRING 0 1 1 0 1 1 NO-TRACE-STRING 0 2 2 0 1 1 NO-TRACE-STRING 0 3 3 0 1 1 NO-TRACE-STRING 0 4 4 0 1 1 NO-TRACE-STRING 0 1 5 0 1 1 NO-TRACE-STRING 0 2 6 0 1 1 NO-TRACE-STRING 0 3 0 0 1 1 NO-TRACE-STRING 0 4 1 0 1 1 NO-TRACE-STRING 0 1 1 37 31 10 0 3 .TXT 3 47 19 0 0 Cg a27.000000,27.000000,254 {\rtf\ansi \deff0{\colortbl;\red0\green128\blue128;}{\fonttbl{\f0 \fcharset0\fnil Arial;}}\plain\cf1\fs20 \pard Here we have created a plot in which our new f(x) function is used to interpolate the tabular data (black squares) at 0.02 intervals in x. The interpolated values are plotted as red +'s. Note that a nice smooth curve connects the original tabular data.}