source: aedes_trendest.m

Last change on this file was 80, checked in by tjniskan, 9 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 
1function 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 Juha-Pekka Niskanen <Juha-Pekka.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 -------------
37if min(size(z)) == 1,
38  z = z(:);
39end
40
41M = size(z,1);
42if M<3
43  zz=mean(z);
44end
45
46if nargin < 2, alpha = 1e4; end
47
48% Create a sparse second difference matrix
49e = ones(M,1);
50D2 = spdiags([e -2*e e], 0:2, M-2, M);
51
52% Create sparse identity matrix
53H = speye(M,M);
54zhat = (H+alpha^2*D2'*D2)\z;   % Smooth. priors estimate
55zz = zhat;
Note: See TracBrowser for help on using the repository browser.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008