Revision 944, 0.9 kB
(checked in by smidl, 14 years ago)
|
Doc + new examples
|
Line | |
---|
1 | classdef mexDirac < mexEpdf |
---|
2 | % Dirac delta probability distribution |
---|
3 | properties |
---|
4 | point % point of the support |
---|
5 | end |
---|
6 | methods |
---|
7 | function m=mean(obj) |
---|
8 | m = obj.point; |
---|
9 | end |
---|
10 | function obj=validate(obj) |
---|
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) |
---|
21 | dim = size(obj.point,1); |
---|
22 | end |
---|
23 | function v=variance(obj) |
---|
24 | v=zeros(size(obj.point)); |
---|
25 | end |
---|
26 | function l=evallog(obj,x) |
---|
27 | if obj.point==x |
---|
28 | l = inf; |
---|
29 | else |
---|
30 | l=0; |
---|
31 | end |
---|
32 | end |
---|
33 | function s=sample(obj); |
---|
34 | s = obj.point; |
---|
35 | end |
---|
36 | end |
---|
37 | end |
---|