This is a static copy of a profile reportHome
deriv (2 calls, 0.492 sec)
Generated 05-Aug-2011 13:00:44 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/deriv.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
52 | V(3:ly-2,:) = Cd(1)*U(1:ly-4,:... | 2 | 0.262 s | 53.3% |  |
53 | V(3:ly-2,:) = V(3:ly-2,:)+Cd(4... | 2 | 0.197 s | 40.0% |  |
49 | V([ly ly-1],:) = -fliplr(Cde)*... | 2 | 0.033 s | 6.7% |  |
57 | if ist, V = V'; end % Tran... | 2 | 0 s | 0% |  |
55 | end | 2 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.492 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
fliplr | function | 2 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.492 s | 100.0% |  |
Totals | | | 0.492 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 57 |
Non-code lines (comments, blank lines) | 35 |
Code lines (lines that can run) | 22 |
Code lines that did run | 14 |
Code lines that did not run | 8 |
Coverage (did run/can run) | 63.64 % |
Function listing
time calls line
1 function V = deriv(U)
2
3 % DERIV Column-wise derivative estimation.
4 % Computes 5-point discrete derivative estimates for each column
5 % of the input matrix U.
6 % V = DERIV(U) Returns a matrix V of the same size as U each
7 % element containing the estimates of the column-wise derivative of
8 % a function sampled at unit intervals in U.
9 %
10 % DERIV Uses 5 points both in the interior and at the edges.
11 % If size of the matrix U is less than 5 use simpler 3-point
12 % or 2-point estimate.
13 %
14 % See also DIFF, GRADIENT, DEL2
15
16 % Kirill K. Pankratov, kirill@plume.mit.edu
17 % March 22, 1994
18
19 % 5-point coefficients for derivatives ..................................
20 % Edges (1st, 2nd pts):
2 21 Cde = [-25/12 4 -3 4/3 -1/4; -1/4 -5/6 3/2 -1/2 1/12];
22 % Interior
2 23 Cd = [1/12 -2/3 0 2/3 -1/12];
24
25 % Determine the size of the input and make column if vector .............
2 26 ist = 0;
2 27 ly = size(U,1);
2 28 if ly==1, ist = 1; U = U(:); ly = length(U); end
29
30 % If only 2 points - simple difference ..................................
2 31 if ly==2
32 V(1,:) = U(2,:)-U(1,:);
33 V(2,:) = V(1,:);
34 if ist, V = V'; end % Transpose output if necessary
35 return
36 end
37
38 % Now if more than 2 points - more complicated procedure ...............
2 39 if ly<5 % If less than 5 points
40
41 V(2:ly-1,:) = (U(3:ly,:)-U(1:ly-2,:))/2; % First
42 V(1,:) = 2*U(2,:)-1.5*U(1,:)-.5*U(3,:); % Last
43 V(ly,:) = 1.5*U(ly,:)-2*U(ly-1,:)+.5*U(ly-2,:); % Interior
44
2 45 else % If 5 points or more - regular, more accurate estimation
46
47 % Edges ............
2 48 V(1:2,:) = Cde*U(1:5,:);
0.03 2 49 V([ly ly-1],:) = -fliplr(Cde)*U(ly-4:ly,:);
50
51 % Interior .........
0.26 2 52 V(3:ly-2,:) = Cd(1)*U(1:ly-4,:)+Cd(2)*U(2:ly-3,:)+Cd(3)*U(3:ly-2,:);
0.20 2 53 V(3:ly-2,:) = V(3:ly-2,:)+Cd(4)*U(4:ly-1,:)+Cd(5)*U(5:ly,:);
54
2 55 end
56
2 57 if ist, V = V'; end % Transpose output if necessary