Home > 02-Probability > demo_plot_histogram_with_theoretical_density.m

demo_plot_histogram_with_theoretical_density

PURPOSE ^

% plot histogram with theoretical density function

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% plot histogram with theoretical density function

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% plot histogram with theoretical density function
0002 
0003 close all
0004 clearvars
0005 
0006 addpath(genpath('../General-Functions'))
0007 
0008 % default parameters
0009 A = 0;
0010 B = 0;
0011 C = 0;
0012 
0013 % Number of generated samples
0014 N = 1000;
0015 
0016 %distribution --- uncomment unused alternatives
0017  
0018 distribution = 'f';
0019 density      = @fpdf;
0020 npar = 2;
0021 A = 53;
0022 B = 1000000;
0023 %
0024 % distribution = 'normal';
0025 % density      = @normpdf
0026 % npar=2
0027 % A=3;
0028 % B=4;
0029 %
0030 % distribution = 'chi2';
0031 % density      = @chi2pdf
0032 % npar=1
0033 % A=5;
0034 
0035 % take sample
0036 switch npar
0037     case 1
0038         x = random(distribution,A,N,1);
0039     case 2
0040         x = random(distribution,A,B,N,1);
0041 end
0042 
0043 ss = plot_init;
0044 figure('Color','w','Position',[20 ss(2)/2-100 ss(1)/2 ss(2)/2]);
0045 hold on
0046 
0047 sugr_plot_histogram_density(x,density,npar,A,B,C);
0048

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005