📄 realproba.m
字号:
% realproba() - compute the effective probability of the value % in the sample.%% Usage: % >> [probaMap, probaDist ] = realproba( data, discret);%% Inputs:% data - the data onto which compute the probability% discret - discretisation factor (default: (size of data)/5)% if 0 base the computation on a Gaussian % approximation of the data %% Outputs:% probaMap - the probabilities associated with the values% probaDist - the probabilities distribution %% Author: Arnaud Delorme, CNL / Salk Institute, 2001%123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 2001 Arnaud Delorme, Salk Institute, arno@salk.edu%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA% $Log: realproba.m,v $% Revision 1.1 2002/04/05 17:39:45 jorn% Initial revision%function [ probaMap, sortbox ] = realproba( data, BOXES );if nargin < 1 help realproba; return;end;if nargin < 2 BOXES = round(size(data,1)*size(data,2)/5);end; if BOXES > 0 % COMPUTE THE DENSITY FUNCTION % ---------------------------- SIZE = size(data,1)*size(data,2); sortbox = zeros(1,BOXES); minimum = min(data(:)); maximum = max(data(:)); data = floor((data - minimum )/(maximum - minimum)*(BOXES-1))+1; for index=1:SIZE sortbox(data(index)) = sortbox(data(index))+1; end; probaMap = sortbox(data) / SIZE; sortbox = sortbox / SIZE;else % BASE OVER ERROR FUNCTION % ------------------------ data = (data-mean(data(:)))./std(data(:)); probaMap = exp(-0.5*( data.*data ))/(2*pi); probaMap = probaMap/sum(probaMap); % because the total surface under a normalized Gaussian is 2 sortbox = probaMap/sum(probaMap);end;return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -