Home » Products » SPL

"DADiSP inspired everyone and produced radical shifts in thinking."

- Felix Grant, Scientific Computing World
Download Now | Pricing / Purchase 


A brief comparison for those of you who aren't afraid to explore alternatives...

If you have found this web page, you might be familiar with the MATLAB (1) software from the MathWorks or one of the free clones. While the rest of this website is devoted to DSP Development Corporation and its flagship DADiSP product, this particular page focuses on the similarities and differences between MATLAB and our alternative, DADiSP.

Emerging Academic Powerhouse

The introduction of the Student Edition of DADiSP (a free download for all academic users, by the way) has caused quite a stir at universities and academic institutions around the world. Over the last few years, DSP Development has licensed DADiSP formally to dozens of top universities and training institutes, but the Student Edition program has put DADiSP into the hands of tens of thousands of students and academics to use for research or teaching.

Check this brief description of what DADiSP is and what it can do for you. You can also watch our introductory Flash Demo and Executive Summary for a quick overview of DADiSP and the concept of an engineering spreadsheet.

Technical Computing Tools

For MATLAB users, one of the more interesting features of DADiSP is a comprehensive data series processing language called SPL. Many students and instructors who are familiar with MATLAB and similar products have asked us what makes SPL different. Here's the scoop...

Although DADiSP and MATLAB are both software tools designed for a technical audience, the products differ considerably in how they meet the demanding data analysis needs of scientists and engineers.

Matrix Based M Files

MATLAB is a matrix-based programming language. In fact, MATLAB stands for "MATrix LABoratory" and was originally developed to provide easier programming access to specialized matrix processing routines. MATLAB consists primarily of a command interpreter and a variety of sub-routines that reside in ASCII files known as M files. Typically, the MATLAB user types out expressions or writes small M files to analyze data and generate graphics.

Engineering Spreadsheet

DADiSP, on the other hand, is a full-featured data analysis and visualization environment designed around a more generalized data construct called a data series. A DADiSP series can represent anything -- from a time domain radar signal to a medical image -- and includes important attributes about the data. The product's highly graphical user interface features interrelated "live" graphical windows, manipulated by simple pull-down menus, dialog boxes and point-and-click operation. Graphs are automatic and dynamic. By working in this powerful and familiar environment, the DADiSP user avoids the many perils of programming.

DADiSP - Language Included

In short, MATLAB is essentially an interpreted programming environment, somewhat analogous to Visual Basic with technical data analysis capability. DADiSP is more like a spreadsheet, a non-programming core methodology that includes a programming language, similar to the combination of Excel and Visual Basic.


The ultimate design goal of DADiSP is to allow the user to focus on the problem at hand and not the code in the debugger. However, for those who wish to customize DADiSP or add special processing capability, DADiSP provides a robust series processing language called SPL. SPL is based on the very popular C/C++ language and sports a C/C++ like syntax.

"For anyone with some experience in C, C++, C# or Java, SPL routines have a clean and familiar style about them. Because MATLAB was originally developed in FORTRAN and later rewritten in C, some feel MATLAB programs exhibit a less consistent, 'mixed breed' feel by combining FORTRAN and C coding styles" says Randy Race, DSP's Chief Technical Officer and designer of SPL.

Like many contemporary programming languages, SPL is implemented as an interpreted language where each statement is incrementally compiled once to low level bytecode. The bytecode is then executed on a virtual machine. This approach often results in quicker turn around time by eliminating the tedious compile-link-test cycle required by traditional compiled languages. However, because many of the core numeric processing algorithms are implemented as built-in C/C++ routines, SPL functions can execute at speeds approaching purely compiled languages.

A Comparison

Although MATLAB and SPL have there own approach and advantages, it is fairly easy to convert routines from one to the other. For example, here are two routines that perform numerical quadrature based on the trapezoidal rule -- one written in MATLAB and the other in DADiSP SPL:

MATLAB M File SPL Function

function s = traprl(f, a, b, m)
% trapezoidal rule.

h  = (b - a)/m;
s = 0;

for k=1:(m-1),
  x = a + h*k;
  s = s + feval(f,x);

s = h*(feval(f,a)+feval(f,b))/2;
s = s + h*s;

traprl(f, a, b, m)
  // trapezoidal rule

  h  = (b - a)/m;
  s = 0;

  for (k = 1; k < m; k++) {
    x = a + h*k;
    s = s + feval(f,x);

  s = h*(feval(f,a)+feval(f,b))/2;
  s = s + h*s;


Besides non-functional formatting differences, it is clear that the examples above are quite similar. The main differences here are the single line comment character (// verses % ) and the "for" loop syntax. SPL uses C/C++ style initialization and increment constructs where MATLAB employs a specialized vector-like syntax. Like C/C++, the SPL function uses the return statement to return a value. By comparison, the return value is part of the function declaration in MATLAB. Although one could argue which language is "better" or clearer overall, the SPL routine is understood very easily by those familiar with C/C++.

An example that illustrates further differences between SPL and MATLAB, consider a routine to remove a linear trend from a series or table as found in the MATLAB M file toolbox:


function y = detrend(x,o)
%DETREND Remove a linear trend from a vector, usually for
%        FFT processing.
%   Y = DETREND(X) removes the best straight-line fit from
%   the data in vector X and returns it in vector Y.  If X
%   is a matrix, DETREND removes the trend from each column
%   of the matrix.
%   Y = DETREND(X,0) removes just the mean value from vector
%   X, or the mean value from each column, if X is a matrix.

%   J.N. Little 6-08-86
%   Revised 2-29-88 JNL
%   Copyright (c) 1986-88 by the MathWorks, Inc.

if nargin == 1
    o = 1;
[m,n] = size(x);
if m == 1    % If a row, turn into column vector
    x = x(:);
[mp,np] = size(x);
if o == 0    % Remove just mean from each column
    y = x - ones(mp,1)*mean(x);
else        % Remove straight-line fit from each column
    a = [(1:mp)'/mp ones(mp,1)];
    y = x - a*(a\x);
if m == 1
    y = y.';

SPL Function
*                                                            *
* DETREND.SPL Copyright (C) 2005 DSP Development Corporation *
*                       All Rights Reserved                  *
*                                                            *
* Author:     Randy Race                                     *
*                                                            *
* Synopsis:   Remove a linear trend from a series or array   *
*                                                            *
* Revisions:  12 May 2005  RRR  Creation - from DETREND.M    *
*                               Copyright (c) 1986-88 by     *
*                               the MathWorks, Inc.          *
*                                                            *



Purpose: Removes a linear trend from a series or array

Format:  DETREND(X, OPT)

           X - input series or array

         OPT - optional integer,
                0: remove mean
                1: do not remove mean (default)

Returns: A series or array

Example:  W1: gline(100, .01, 1, 0)
          W2: detrend(W1)

          W2 consists of a 100 point line with slope
          and intercept of 0.0.

See Also: Gline


// remove a linear trend
detrend(x, opt)
    local y;

    // if opt not specified, default to 1
    if (argc == 1)
        opt = 1;

    if (opt == 0)
        // remove the mean from each column
        y = x - colmean(x);
        // remove a linear trend from each column
        y = x - linreg(x);


Yet Different

Both SPL and MATLAB are free-form and the examples above show the typical formatting styles of each language. The comment block after the function declaration in a M file is displayed when the user types help detrend. SPL displays the free-form text between the #if @HELP_DETREND and #endif block. This block can be placed anywhere within the SPL file.

detrend removes the least squares line from a series or table. The function also has an optional argument to specify that only the mean value should be removed. This optional argument is detected in MATLAB by counting the number of input arguments with nargin. SPL uses the C/C++ like argc to indicate the number of input parameters.

Matrix vs Series Based Solution

Because MATLAB is matrix-based and series are stored in row form, row vectors must be transposed into columns. In fact, operators such as * and / actually perform matrix multiplication and inversion. Because SPL is series-based, row transpositions are not required and mathematical operators work in the way you would expect. SPL includes the explicit operators *^ and \^ to multiply and solve matrices.

If the optional argument is set to 1, the mean value of each column is removed by forming a table of the mean values and subtracting it from the data. MATLAB forms the table by creating a matrix of all ones and performing a matrix multiply. SPL simply subtracts the mean value of each column from the corresponding column.

The linear trend is removed by forming a least squares line. Again, MATLAB resorts to matrix operations where SPL uses the linreg function.

Although both routines accomplish the same goal, MATLAB approaches the problem from a matrix point of view, where SPL offers a series-based solution. Each approach has its advantages, but for problems that involve single or multi-column data series, SPL can result in clearer, more direct code.

M File Memory Limitations

All arrays in MATLAB are limited by the amount of physical memory. Because MATLAB relies on the operating system's general purpose implementation of virtual memory, if an array size exceeds the available memory, calculations produce errors or grind to a halt if a memory page is swapped to disk.

Virtual Series Management

SPL employs a optimized method called virtual series management. Each series and each column of an array is limited only by available disk space. If the series size exceeds available memory, SPL automatically uses hard disk storage. Because virtual series management is optimized for series processing, this method is much faster and more robust than general purpose operating system page swapping. The size of a series kept in memory is adjustable, allowing users to optimize processing based on system memory. With SPL, the memory footprint of large data series is small enough to bypass slow operating system page swapping, but computation is fast due to virtual data handling designed specifically for series processing. Thus, SPL is ideally suited for manipulating any number of very large data series.

More M File Issues

Because of the mixed heritage of the MATLAB language, several potentially confusing ambiguities persist. For example, the MATLAB * operator actually performs a matrix multiply. A common expression like:

  a * b

would perform matrix multiplication if a and b are arrays or a standard multiply if either variable is a scalar. A careful reading of the code is required to establish the specific meaning of this simple expression.

SPL preserves the standard meaning of * and introduces the *^ operator for explicit matrix multiplication. Thus,

  a * b

is always a standard multiplication whereas

  a *^ b

is always a matrix multiplication. The intent of either expression is immediately obvious.

Further, the MATLAB expression:

  b = f(x)

could refer to element x of array f or function f called with argument x. Again, a careful reading of the code is required to disambiguate the two possible meanings.

In SPL as well as C/C++,

  b = f(x)

is always a function call and

  b = f[x]

is always an array reference. The intent is immediately clear and consistent with the C/C++ family of modern programming languages.

C/C++ Style Syntax

In fact, SPL borrows so much of its syntax from C/C++ that many C/C++ programs can be loaded directly as SPL routines! For example, SPL supports C/C++ operators such as ++, --, +=, -=, /=, *= %=, ==, !=, >>, <<, >>=, <<=, ||, && and scalar pointers. Looping and iteration constructs such as for, while, do while, if, else, switch, goto work exactly as they do in C/C++. Array construction also mimics the C/C++ syntax. SPL also includes a full C/C++ like preprocessor: #if, #ifdef, #elif, #endif, #include, #define, #undef.

Useful Constructs

But SPL also borrows some good ideas from MATLAB. Matrix operators such as matrix multiply *^, \^ to multiply and solve matrices and transpose ' are supported. Powerful array addressing constructs such range specifiers 1..10, array assignments A[1..10] = 5, multiple return values (a, b) = f(x), automatic loading of SPL routines and built-in help syntax are provided.

A simple table gives a brief summary of the operators and syntax supported by MATLAB, C/C++ and SPL.

Execute M Files Directly in DADiSP

The MATLINK Module, included with DADiSP, provides a simple interface for executing MATLAB code directly from DADiSP. Any MATLAB function or script can be processed just as if it were a native DADiSP function.

No need to rewrite code or manipulate temporary data files. MATLINK combines the functionality of existing MATLAB programs with the ease and power of the DADiSP Worksheet environment.

Series, arrays, scalars and strings are exchanged seamlessly. Series and array results returned from MATLAB plot automatically in DADiSP. MATLAB code embedded into a Worksheet Window formula is hot linked and automatically re-executes when the Window updates.

Convert M Files to SPL

For those who desire a native SPL implementation of an M file, The MathWorks offers a MATLAB-to-C conversion utility. Because SPL is so similar to C/C++, you can also use this utility as a great shortcut for converting M files into SPL functions for use in DADiSP.

MAT File Support

Finally, if your data is saved in MATLAB's binary MAT file format, the DADiSP/MAT File Module reads and loads all MAT Files of Version 4 and higher.

(1) MATLAB is a registered trademark of The MathWorks, Inc.