from
Matrix Library for Simulink
by Jay St. Pierre
A set of blocks for manipulating 3x3 and 4x4 matrices.
|
| mmtest.m |
%MMTEST runs timing tests for Matrix Multiply algorithms.
% $Source: /home/stpierre/cvsroot/matlab/simulink/matrix/test/mmtest.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=1.5e6;
A=[1 2 3; 4 5 6; 7 8 9];
AB=A*A;
save mmtest_vars stop_time A AB
mmtest1
mmtest2
mmtest3
disp(' ')
clear, pack
disp('mmtest1:')
disp('========')
load mmtest_vars
ts=timesim('mmtest1');
simAB=rm2mat(simout);
if simAB == AB
disp('simAB == AB ***PASSED***')
else
disp('simAB ~= AB ***FAILED***')
simAB
AB
end
disp(['Time: ', num2str(ts)])
disp(' ')
clear, pack
disp('mmtest2:')
disp('========')
load mmtest_vars
ts=timesim('mmtest2');
simAB=rm2mat(simout);
if simAB == AB
disp('simAB == AB ***PASSED***')
else
disp('simAB ~= AB ***FAILED***')
simAB
AB
end
disp(['Time: ', num2str(ts)])
disp(' ')
clear, pack
disp('mmtest3:')
disp('========')
load mmtest_vars
ts=timesim('mmtest3');
simAB=rm2mat(simout);
if simAB == AB
disp('simAB == AB ***PASSED***')
else
disp('simAB ~= AB ***FAILED***')
simAB
AB
end
disp(['Time: ', num2str(ts)])
disp(' ')
|
|
Contact us at files@mathworks.com