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.

mttest.m
%MTTEST runs timing tests for Matrix Transpose algorithms.

% $Source: /home/stpierre/cvsroot/matlab/simulink/matrix/test/mttest.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];

save mttest_vars stop_time A

mttest1
mttest2
mttest3
disp(' ')

clear, pack
disp('mttest1:')
disp('========')
load mttest_vars
ts=timesim('mttest1');
simAt=rm2mat(simout);
if simAt == A.'
  disp('simAt == A.''  ***PASSED***')
else
  disp('simAt ~= A.''  ***FAILED***')
  simAt
  Ax
end
disp(['Time: ', num2str(ts)])
disp(' ')

clear, pack
disp('mttest2:')
disp('========')
load mttest_vars
ts=timesim('mttest2');
simAt=rm2mat(simout);
if simAt == A.'
  disp('simAt == A.''  ***PASSED***')
else
  disp('simAt ~= A.''  ***FAILED***')
  simAt
  Ax  
end
disp(['Time: ', num2str(ts)])
disp(' ')

clear, pack
disp('mttest3:')
disp('========')
load mttest_vars
ts=timesim('mttest3');
simAt=rm2mat(simout);
if simAt == A.'
  disp('simAt == A.''  ***PASSED***')
else
  disp('simAt ~= A.''  ***FAILED***')
  simAt
  Ax  
end
disp(['Time: ', num2str(ts)])
disp(' ')

Contact us at files@mathworks.com