X=[3.01
18.40
15.51
34.84
32.29
10.19
19.56
10.30
8.80
5.44
11.46
15.16
29.98
22.92
12.38
8.33
2.66
15.63
26.97
29.63
39.70
19.21
21.06
12.85
9.14
14.00
29.75
21.53
37.73
29.98
16.09
3.13
6.71
15.86
19.44
36.92
9.14
32.64
8.80
7.99
1.39
10.30
14.93
9.95
24.42
33.10
17.71
10.19
];
X = sort(X);%排序
mu=mean(X); %平均值
sigma=std(X); %标准差
%偏度c3
[rows, cols]=size(X);%行列数
X_max = max(X);
X_min = min(X);
x=linspace(0,48,100);
X=X(:);
alpha=0.05;%显著水平
Xlength = length(X);
xlength = length(X);
if Xlength == 10
h = 1.416278786*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 11
h = 1.420835443*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 12
h = 1.420269570*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 13
h = 1.420698785*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 14
h = 1.420669671*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 15
h = 1.420693321*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 16
h =1.420692226*(X_max - X_min)/(Xlength - 1);
elseif Xlength == 17
h =1.420693101*(X_max - X_min)/(Xlength - 1);
elseif Xlength > 17
h = 1.420693101*(X_max - X_min) / (Xlength - 1);
else
h = 0;
end
C = zeros(Xlength, 1);
q = zeros(Xlength, 1);
for i = 1 : Xlength
for j = 1 : Xlength
f(i, j) = 1.0 / (h * sqrt(2 * pi)) * exp(-(X(i) - X(j)) ^ 2 / (2 * h ^ 2));
C(i) = C(i) + f(i, j);
end
end
for i = 1 : Xlength
for j = 1 : Xlength
f(i, j) = f(i, j) / C(i);
q(j) = q(j) + f(i, j);
end
end
Q = sum(q);
p = q ./ Q;
c=0;
for i=1:Xlength
P(i)=c+p(i);
c=P(i);
end
P=P';
% % 信息扩散估计检验
[H4,s4,a4,b4]=kstest(X,[X,P],alpha);
if H4==0
disp('该数据服从正态信息扩散分布分布。')
else
disp('该数据不服从正态信息扩散分布。')
end
s=1.55E-04+(3+0.05)*1.54E-04;
出现下面的错误要怎么改啊
**错误使用 horzcat
要串联的数组的维度不一致。
出错 untitled (第 107 行)
[H4,s4,a4,b4]=kstest(X,[X,P],alpha);**