Revision 983, 1.4 kB
(checked in by smidl, 14 years ago)
|
doc - extensions
|
Line | |
---|
1 | classdef mexDirac < mexEpdf |
---|
2 | % Dirac delta probability distribution |
---|
3 | properties % DATA structures |
---|
4 | point % point of the support |
---|
5 | end |
---|
6 | methods |
---|
7 | function m=mean(obj) % compute mean values of the density |
---|
8 | m = obj.point; |
---|
9 | end |
---|
10 | function obj=validate(obj) % check if data structures are consistent |
---|
11 | % point should be a column |
---|
12 | if (size(obj.point,2)>1) |
---|
13 | if (size(obj.point,1)==1) % it is row |
---|
14 | obj.point = obj.point'; |
---|
15 | end |
---|
16 | else |
---|
17 | error('Point in mexDirac is not a vector'); |
---|
18 | end |
---|
19 | end |
---|
20 | function dim=dimension(obj) % inform others about your dimensions |
---|
21 | dim = size(obj.point,1); |
---|
22 | end |
---|
23 | function v=variance(obj) % compute variance |
---|
24 | v=zeros(size(obj.point)); |
---|
25 | end |
---|
26 | function l=evallog(obj,x) % return logarithm of your density at point x |
---|
27 | if obj.point==x |
---|
28 | l = inf; |
---|
29 | else |
---|
30 | l=0; |
---|
31 | end |
---|
32 | end |
---|
33 | function s=sample(obj); % return random sample from your density |
---|
34 | s = obj.point; |
---|
35 | end |
---|
36 | end |
---|
37 | end |
---|