Advertisement
Advertisement

MathCAD functions perform log interpolation

-October 30, 2003

MathCAD provides a number of interpolation and curve-fitting functions, so that, given a set of X-Y data points, you can estimate the Y value for any given X coordinate. Unfortunately, these functions work poorly with data that is to be displayed in a nonlinear (logarithmic) manner. Examples of these functions are:

  • Log-Lin: phase/magnitude-versus-frequency (Bode plots);

  • Log-Log: impedance-versus-frequency (reactance plots); and

  • Lin-Log: impedance-versus-temperature (thermistor data).

Using the built-in "linterp" function, MathCAD estimates and plots the data (Figure 1). As you can see, at X coordinates between the original data points, the "linterp" function creates a "bulging" effect. The following trio of simple interpolation functions allows the correct interpolation of nonlinear data on its appropriate scale. These routines function by prewarping the incoming-data matrices before feeding them into the existing "linterp" function; for logarithmic Y-axis functions, you raise 10 to the result of the "linterp" function to restore the values to the proper decade:

Using the newly created LogLogInterp function, the straight-line data is displayed (Figure 2).

Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES