Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.
Open in the MATLAB editor: g01kq_example
function g01kq_example fprintf('g01kq example results\n\n'); x = [1.0, 4.0, 0.1, 1.0]; xmean = [0.0, 2.0, 0.0, 0.0]; xstd = [1.0, 1.0, 0.01, 10]; ilog = int64(0); [pdf, ivalid, ifail] = g01kq(ilog, x, xmean, xstd); fprintf('\n x mean standard result\n'); fprintf(' deviation\n'); lx = numel(x); lxmean = numel(xmean); lxstd = numel(xstd); len = max ([lx, lxmean, lxstd]); for i=0:len-1 fprintf('%13.5e %13.5e %13.5e %13.5e %3d\n', x(mod(i,lx)+1), ... xmean(mod(i,lxmean)+1), xstd(mod(i,lxstd)+1), pdf(i+1), ivalid(i+1)); end g01kq_plot; function g01kq_plot fig1 = figure; hold on; xmean = [0, 0, 1]; xstd = [1, 0.3, 0.6]; ilog = int64(0); x{1} = [-3:0.05:3]; x{2} = [-1.2:0.025:1.2]; x{3} = [-1:0.05:3]; mu = '\mu'; sigma = '\sigma'; for i=1:3 [y{i}, ifail] = g01kq( ... ilog, x{i}, xmean(i), xstd(i)); plot(x{i},y{i}); l{i} = sprintf('%s = %3.1f, %s = %3.1f', mu, xmean(i), sigma, xstd(i)); end legend(l); xlabel('x'); title('Gaussian Functions (or Normal Distributions)'); hold off;
g01kq example results x mean standard result deviation 1.00000e+00 0.00000e+00 1.00000e+00 2.41971e-01 0 4.00000e+00 2.00000e+00 1.00000e+00 5.39910e-02 0 1.00000e-01 0.00000e+00 1.00000e-02 7.69460e-21 0 1.00000e+00 0.00000e+00 1.00000e+01 3.96953e-02 0