Matrix Functions. Library 837. A library for the HP48 S/SX/G/GX containing a variety of matrix manipulating functions.
MATFUN is a collection of useful matrix functions for the HP48, designed to simplify working with matrices. It was concieved as a way of bringing the matrix manipulating power of Matlab to the HP48. Along the way, several additional convenience functions were added that had little to do with the original goal, but were useful nonetheless.
Download either matfun.glb or matfun.slb
(depending upon what type of calculator you have). RCL
the library to the stack and purge the variable it was in. Execute
0 STO
and then warm start your calculator (press
ON+C). If all is OK, it should be available in the library
menu.
For brevity, several symbols are used to denote types native to the HP48.
%
C%
::
[]
{}
SYMB
Incremented Array
Create an evenly incremented array from %start to %finish, optionally in steps of %increment.
Create an array of size 1 × %colums or %rows × %columns filled with %1.
Create an array of size 1 × %colums or %rows × %columns filled with %0.
To 2-D
Ensure a matrix is two dimensional, converting from a vector if needed.
Calculate the size of largest dimension of an array.
Matrix Elements
Apply a program or an equation to each element of an array.
Flip Left Right
Exchange all columns of an array. This routine is significantly faster when the array is a row vector.
Flip Up Down
Exchange all rows of an array. This routine is significantly faster when the array is a column vector.
Matrix Minimum
Columnwise minimum of an array
Matrix Maximum
Columnwise maximum of an array
Matrix Plot
Plots the columns of an array in the same manner as Matlab's plot routine. If the array is a real column vector, each element is plotted versus its index. If the array is real and not a column vector, all of the columns are plotted against the first. If the array is complex, each column is plotted individually as the imaginary part versus the real part.
Stem Plot
Stem plots vectors. If the input is a column vector, each element is plotted versus its index. If the input has two columns the second column is plotted versus the first. If the input is a complex column vector, the imaginary part of each element is plotted versus the real.
Matrix Fast Fourier Transform
Fourier transform a vector. If the length of the input is a power
of two, the internal FFT
routine is used. Otherwise the
a discrete Fourier transform is calculated from the definition (and is
not particularly fast).
FIR and IIR filter. For the FIR filter, if no scalar is specified, the scale factor is assumed to be %1. If a scale factor is specified, the filter vector is normalized by it. For the IIR filter, if the first element of the denominator isn't %1, the vector is normalized by it. An initial condition vector may also be specified for the IIR filter.
Note: The IIR filter is not implemented as of MATFUN version 3.0.
Convolution
Convolution and polynomial multiplication.
Circular convolution
Interpolation
Non linear interpolation. This algorithm is designed to work best with periodic signals, however it usually performs adequately with aperiodic signals.
Sinc funtion
Calculates the sinc of real numbers, complex numbers, and arrays of either. The sinc function is defined as sin(x)/x.
Matrix plus
Element-wise addition.
Matrix minus
Element-wise subtraction.
Matrix multiplication
Element-wise multiplication.
Matrix division
Element-wise division.
Matrix Sum
The sum of all of the elements in an array.
Matrix Product
The product of all of the elements of an array.
Matrix Rotate Left
Circularly rotates a vector left the number of elements specified.
Matrix Rotate Right
Circularly rotates a matrix right the number of elements specified.
Prepend 0
Prepends the specified number of zeros onto an array.
Append 0
Appends the specified number of zeros onto an array.
Matrix Transpose
Performs matrix transposition, but does not take the complex conjugate of complex matrices.
Swaps the left and right halves of a vector, which after a Fourier transform moves the zero point to the middle
Text Copyright © 2006 Jonathan duSaint. All rights reserved.