⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 normtest.m

📁 信道仿真的很好程序
💻 M
字号:
function q=normtest(data,bins)%Gayatrii Prabhu and P. M. Shankary=sort(data);y=(y-mean(y))./std(y); %mean 0, var 1inter=max(y)-min(y); %interval for chi-square test intstep=inter/bins; %size of sub-intervalintval=[min(y):intstep:max(y)]; %samples at the sub-intervalsk=[zeros(1,bins)]; %number of samples in each sub-interval%counting the samples in each sub-intervalfor i=1:length(y)   for j=1:bins      if y(i)<=intval(j+1)         k(j)=k(j)+1;         break;      end;   end;end;Fy=normcdf(intval,0,1); %cdf at each sub-interval sample p=zeros(1,bins);for i=1:bins   p(i)=Fy(i+1)-Fy(i); %probabilities at the sub-interval samplesend;np=p.*length(y);q=0; for i=1:bins   q = q + ((k(i)-np(i))^2)/np(i); %chi-square test statisticend;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -