plotLikelihood - plots the observation likelihood given the supplied parameters plotLikelihood( accuracy, sigma, epsilon, range ) parameter: accuracy - the accuracy of the sensor (numeric) (the likelihood within accuracy of the observation is considered to be equally likely) parameter: sigma - the standard deviation of the likelihood (real numeric) parameter: epsilon - the bias (real numeric) parameter: range - the range to plot numeric vector with two elements parameter: step - step between points in the plot AUTHOR Ronnie Johansson CREATED 2005-02-02 ALTERED
0001 function plotLikelihood( accuracy, sigma, epsilon, range, step ) 0002 % 0003 % plotLikelihood - plots the observation likelihood given the 0004 % supplied parameters 0005 % plotLikelihood( accuracy, sigma, epsilon, range ) 0006 % parameter: accuracy - the accuracy of the sensor (numeric) (the 0007 % likelihood within accuracy of the observation is considered to be 0008 % equally likely) 0009 % parameter: sigma - the standard deviation of the likelihood (real numeric) 0010 % parameter: epsilon - the bias (real numeric) 0011 % parameter: range - the range to plot numeric vector with two elements 0012 % parameter: step - step between points in the plot 0013 % 0014 % AUTHOR Ronnie Johansson 0015 % CREATED 2005-02-02 0016 % ALTERED 0017 % 0018 0019 if (length(range) < 2) 0020 disp('parameter range should be a vector with two elements!'); 0021 return; 0022 end 0023 0024 min_d = min(range); 0025 max_d = max(range); 0026 0027 d_1 = []; 0028 d_2 = []; 0029 0030 if min_d < accuracy 0031 d_1 = (min_d:step:min( max_d, accuracy ))'; 0032 end 0033 0034 if max_d > accuracy 0035 d_2 = (max( accuracy, min_d ):step:max_d)'; 0036 end 0037 0038 p = []; 0039 0040 if ~isempty( d_1 ) 0041 p = [p; ones(length(d_1),1)+epsilon]; 0042 end 0043 0044 if ~isempty( d_2 ) 0045 p = [p; epsilon+exp(-(d_2-accuracy).^2/(2*sigma^2))]; 0046 end 0047 0048 figure; hold on; 0049 axis([0 max_d 0 1+epsilon+0.1]); 0050 plot([d_1;d_2], p); 0051 %plot([range(1):step:accuracy accuracy:step:range(2)], p); % equivalent