% PLOT_APD_PDF_SURF.M % PLOTAPDPDFSURF.M plots the surfaces corresponding to the pdfs of an APD % random variable with parameters ALPHA and LDA. Here LDA is held fixed % and ALPHA varies in (0,1) % % Comments: % a standard APD(alpha,lda) random variable X has probability density: % p(alpha,lda,x) = [A^(1/lda)/gamma(1+1/lda)]*... % *exp[-(A/alpha^lda)*abs(x)^lda], if x <= 0, % *exp[-(A/(1-alpha)^lda)*abs(x)^lda], if x > 0, % where A = (2*alpha^lda*(1-alpha)^lda)/(alpha^lda+(1-alpha)^lda). % % References: % [1] Komunjer, I. (2006): "Asymmetric Power Distribution: Theory and % Applications to Risk Measurement" % % Author: Ivana Komunjer - UCSD (komunjer@ucsd.edu) % Version: 2.1 Date: 06/07/2006 % Inputs the values of lda lda = [0.8;1;2;4]; % Controls the precision of the plot Nprec = 51; % number of points on the grid % First define X and Y axis: X = x and Y = alpha alpha = [((1/Nprec):(2/Nprec):0.5)';0.5;((0.5+1/Nprec):(2/Nprec):(1-1/Nprec))']; x = (-5:(10/Nprec):5)'; y = alpha; resden = zeros(size(x,1),size(alpha,1),size(lda,1)); for j = 1:1:size(lda,1) den = []; for i = 1:1:size(alpha,1) d = APDpdf(alpha(i)*ones(size(x)),lda(j)*ones(size(x)),x); den = [den,d]; end resden(:,:,j) = den; end subplot(2,2,1); surf(x,alpha,resden(:,:,1)'); colormap hsv; axis([-5 5 0 1 0 0.6]); title('Lambda = 0.8'); subplot(2,2,2); surf(x,alpha,resden(:,:,2)'); colormap hsv; axis([-5 5 0 1 0 0.6]); title('Lambda = 1'); subplot(2,2,3); surf(x,alpha,resden(:,:,3)'); colormap hsv; axis([-5 5 0 1 0 0.6]); title('Lambda = 2'); subplot(2,2,4); surf(x,alpha,resden(:,:,4)'); colormap hsv; axis([-5 5 0 1 0 0.6]); title('Lambda = 4');