Doxygen Source Code Documentation
CompCondNum.m
Go to the documentation of this file.00001 function [err,CondNum] = CompCondNum (N_tasks, N_basis, Task, N_TR, polort)
00002 %
00003 % [err,] = CondNum ()
00004 %
00005 %Purpose:
00006 %
00007 %
00008 %
00009 %Input Parameters:
00010 %
00011 %
00012 %
00013 %Output Parameters:
00014 % err : 0 No Problem
00015 % : 1 Problems
00016 %
00017 %
00018 %
00019 %Key Terms:
00020 %
00021 %More Info :
00022 %
00023 %
00024 %
00025 %
00026 % Author : Gang Chen
00027 % Date : Wed Aug 20 15:46:08 EDT 2003
00028 % SSCC/NIMH/ National Institutes of Health, Bethesda Maryland
00029
00030
00031 %Define the function name for easy referencing
00032 FuncName = 'CondNum';
00033
00034 %Debug Flag
00035 DBG = 1;
00036
00037 %initailize return variables
00038 err = 1;
00039 %N_tasks=4;
00040 %N_basis = 1;
00041
00042 fprintf (1,'\n');
00043 for (i=1:1:N_tasks),
00044 for (j=1:1:N_basis),
00045 fprintf(2, 'Loading %s\n', Task(i).Name(j).str);
00046 X = load (Task(i).Name(j).str);
00047 %length(X)
00048 Max(i) = max(X);
00049 if (i==1 & j==1),
00050 Xm = X(:);
00051 stmp = sprintf('%s ', Task(i).Name(j).str);
00052 else
00053 Xm = [Xm X(:)];
00054 stmp = sprintf('%s %s', stmp, Task(i).Name(j).str);
00055 end
00056
00057 end
00058 % t = [0:1:(length(X)-1)];
00059 % plot (t, Xm); title (stmp, 'Interpreter', 'none');
00060 end
00061 one = ones(N_TR,1);
00062
00063 %slope = 0;
00064 for (i = 1:N_TR), %create the coloumn(s) for the drifting
00065 for (j = 1:1:polort),
00066 slope(i, j) = (i-1)^j;
00067 end
00068 end
00069 %design matrix
00070 Dsgn = [one slope Xm];
00071 %check condition number of the design matrix
00072 %M = Dsgn'*Dsgn;
00073 CondNum = cond(Dsgn'*Dsgn);
00074
00075 err = 0;
00076 return;
00077