matlab alpha稳定分布

源代码在线查看: nihe.m

软件大小: 168 K
上传用户: MOMO89752118
关键词: matlab alpha 分布
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				clc;
				clear all;
				x=-5:0.1:5;
				alpha=1 ;
				sigma=2;
				gamma=(sigma/2)^alpha;
				beta=1;
				N=5000;
				delta=0;
				p_z = stblpdf(x,alpha,0,gamma,0);
				plot(x,p_z);hold on
				% tao_par_pdf=stblpdf(x,alpha/2,beta,cos(alpha*pi/4)^(2/alpha),0);
				% plot(x,tao_par_pdf,'r');hold on
				tao_par=stblrnd(alpha/2,beta,cos(alpha*pi/4)^(2/alpha),0,1,N);
				for i=1:N
				    p_tao(i)=stblpdf(tao_par(i),alpha/2,beta,cos(alpha*pi/4)^(2/alpha),0);
				end
				p_tao_sum=sum(p_tao);
				p_tao_norm=p_tao/p_tao_sum;
				uu=(rand(1,1)+[0:N-1])/N;
				c(1)=p_tao_norm(1);
				for ii=2:N 
				    c(ii)=c(ii-1)+p_tao_norm(ii);
				end
				
				for k=1:N 
				    ii=1;
				    while uu(k)>c(ii)&ii				        ii=ii+1;
				    end
				    tao_par_re(:,k)=tao_par(:,ii);
				end
				
				for i=1:N
				pdf_nihe(i,:)=(1/(2*pi*tao_par_re(i)*sigma))*exp(-x.*x/(2*tao_par_re(i)*sigma));
				end
				pdf_nihe=sum(pdf_nihe)/N;
				plot(x,pdf_nihe,'r');hold on
				
							

相关资源