% % clear all % c2val = 2; if c2val==1 c2 = 1.0; x1 = 1.7; x2 = 2.3; elseif c2val==2 c2 = 0.1; x1 = 0.9; x2 = 1.3; else c2 = 0.01; x1 = 0.8; x2 = 1.2; end c1 = 1.0; N = 1e+5; per = 0.1; X = [c1; c2]; F = X*X'; [V,D] = eig(F) [U,S,V] = svd(X','econ'); param = (1-per) + 2*per*rand(N,1); y1 = c1*param + c2; y2 = c1*param + c2*param; xvals = x1:0.005:x2; dens1 = ksdensity(y1,xvals); dens2 = ksdensity(y2,xvals); % [bandwidth2,dens2,dens2mesh,cdf2] = kde(y2); % [bandwidth1,dens1,dens1mesh,cdf1] = kde(y1); % % Plot the distributions for y1 and y2. % figure(1) plot(xvals,dens2,'b',xvals,dens1,'b--','linewidth',4) axis([0.95 1.25 0 6]) set(gca,'Fontsize',[24]); xlabel('y') ylabel('PDF') %legend('Random \theta_1,\theta_2','Random \theta_2','Location','South')