|
|
| run_tridi.m |
% #####################################################################################
% Example how to create a mex-file!
% #####################################################################################
%
% see C:\...\Matlab\extern\examples\compiler\README
%
% Giovani Tonel (giotonel@enq.ufrgs.br) - February 2007
clear all
clear functions
clc
disp(' ')
disp(' ')
disp ('#####################################################################################')
disp (' Example how to create a mex-file!')
disp ('#####################################################################################')
% select the compiler
% mex -setup
disp(' ')
disp('If it doesnt works, maybe first you need select the compiler: ''mex -setup''!!!')
disp(' ')
disp(' ... I have used the lcc compiler: ''C:\...\Matlab\sys\lcc''!!!!')
disp(' (5.3 (R11.1) Matlab Version) ')
disp(' ')
disp('Wait... ')
% ################# Compiling to create a .dll file (tridi.dll) ###########################
%
% If you want create a dll file please remove the '%' in the following line
% mcc -V1.2 -ir tridi.m
disp(' ')
disp(' Ok, has been created a tridi.dll file!!!!!!!');
disp(' ')
disp(' ')
disp('###################### Example using the .dll created : ###################');
disp(' ')
disp('Solve the system: M*x=D ')
disp(' ')
% Using the dll created
n=10;
a = ones(1,n-1);
b = rand(1,n);
c = rand(1,n-1);
d = rand(1,n);
M = diag(a,-1) + diag(b,0) + diag(c,1)
D=d'
x = tridi(a,b,c,d)'
residual = M*x-D
|
|
Contact us at files@mathworks.com