Code covered by the BSD License  

Highlights from
Matrix Library for Simulink

image thumbnail
from Matrix Library for Simulink by Jay St. Pierre
A set of blocks for manipulating 3x3 and 4x4 matrices.

mvtest.m
%MVTEST runs timing tests for Matrix Transpose algorithms.

% $Source: /home/stpierre/cvsroot/matlab/simulink/matrix/test/mvtest.m,v $
% $Revision: 1.2 $
% $Date: 2009-07-19 22:03:27 $

% Copyright (c) 2000-2009, Jay A. St. Pierre.  All rights reserved.

stop_time=4e6;
A=[1 2 3; 4 5 6; 7 8 9]; x=[1; 2; 3];
Ax=A*x;

save mvtest_vars stop_time A Ax

mvtest1
mvtest2
disp(' ')

clear, pack
disp('mvtest1:')
disp('========')
load mvtest_vars
ts=timesim('mvtest1');
simAx=simout.';
if simAx == simout.'
  disp('simAx == Ax  ***PASSED***')
else
  disp('simAx ~= Ax  ***FAILED***')
  simAx
  Ax
end
disp(['Time: ', num2str(ts)])
disp(' ')

clear, pack
disp('mvtest2:')
disp('========')
load mvtest_vars
ts=timesim('mvtest2');
simAx=simout.';
if simAx == simout.'
  disp('simAx == Ax  ***PASSED***')
else
  disp('simAx ~= Ax  ***FAILED***')
  simAx
  Ax
end
disp(['Time: ', num2str(ts)])
disp(' ')

Contact us at files@mathworks.com