Last change
on this file was
80,
checked in by tjniskan, 10 years ago

 Changed the historical "an2_" prefix to "aedes_" in all files. NOTE:
Any script or function relying to Aedes functions will be broken
because of this. Just do a search/replace from "an2_" to "aedes_" in
your files and all should be well...
 Changed the name of an2_readtab.m to a more informative
aedes_readphasetable.m

File size:
1.3 KB

Line  

1  function zz = aedes_trendest(z,alpha); 

2  % AEDES_TRENDEST  Estimate trends from signal using smoothness priors 

3  % 

4  % Synopsis: 

5  % function zz = aedes_trendest(z,alpha) 

6  % 

7  % Description: 

8  % Estimate trend from signal z using smoothness priors. t is the time 

9  % scale for z. alpha is the smoothing parameter. 

10  % 

11  % Examples: 

12  % 

13  % See also: 

14  % 

15  % 

16  

17  % This function is a part of Aedes  A graphical tool for analyzing 

18  % medical images 

19  % 

20  % Copyright (C) 2006 JuhaPekka Niskanen <JuhaPekka.Niskanen@uku.fi> and 

21  % Mika Tarvainen. 

22  % 

23  % Department of Physics, Department of Neurobiology 

24  % University of Kuopio, FINLAND 

25  % 

26  % This program may be used under the terms of the GNU General Public 

27  % License version 2.0 as published by the Free Software Foundation 

28  % and appearing in the file LICENSE.TXT included in the packaging of 

29  % this program. 

30  % 

31  % This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 

32  % WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 

33  

34  

35  

36  %% Check dimensions of t and z  

37  if min(size(z)) == 1, 

38  z = z(:); 

39  end 

40  

41  M = size(z,1); 

42  if M<3 

43  zz=mean(z); 

44  end 

45  

46  if nargin < 2, alpha = 1e4; end 

47  

48  % Create a sparse second difference matrix 

49  e = ones(M,1); 

50  D2 = spdiags([e 2*e e], 0:2, M2, M); 

51  

52  % Create sparse identity matrix 

53  H = speye(M,M); 

54  zhat = (H+alpha^2*D2'*D2)\z; % Smooth. priors estimate 

55  zz = zhat; 

Note: See
TracBrowser
for help on using the repository browser.