判定正太分布
data=[19.46 26.84 29.21 24.49
17.25 27.64 29.11 26
15.43 28.11 29.3 27.16
14.14 28.23 29.34 28.29
13.89 28.62 29.14 28.35
13.21 29.01 29.33 28.45
12.84 30.07 29.47 27.62
12.57 30.68 29.64 27.11
12.13 31.02 29.87 26.98
]
numCols = size(data, 2);
% 遍历每一列进行Jarque-Bera检验
for i = 1:numCols
[h, p] = jbtest(data(:, i));
if h == 0
fprintf('第%d列数据服从正态分布(p-value = %.5f)\n', i, p);
else
fprintf('第%d列数据不服从正态分布(p-value = %.5f)\n', i, p);
end
end
% 选择要绘制正态概率图的列
selectedColumns = [1, 2, 3,4]; % 例如,这里我们只选择前3列
% 为每列绘制正态概率图
for i = selectedColumns
figure;
normplot(data(:, i));
title(sprintf('正态概率图 - 第%d列', i));
end
相关性分析可视化 矩阵热力图
% Data for DFA/CS, Tar Yield, Water Yield, Char Yield, Syngas Yield
DFA_CS = [0, 10, 20, 30, 40, 50, 60, 80, 100]';
TarYield = [19.46, 17.25, 15.43, 14.14, 13.89, 13.21, 12.84, 12.57, 12.13]';
WaterYield = [26.84, 27.64, 28.11, 28.23, 28.62, 29.01, 30.07, 30.68, 31.02]';
CharYield = [29.21, 29.11, 29.3, 29.34, 29.14, 29.33, 29.47, 29.64, 29.87]';
SyngasYield = [24.49, 26, 27.16, 28.29, 28.35, 28.45, 27.62, 27.11, 26.98]';
% Creating a table from the data
data = table(DFA_CS, TarYield, WaterYield, CharYield, SyngasYield);
% Calculating the correlation matrix
corrMatrix = corr(data{:,:});
% Plotting the heatmap of the correlation matrix
figure;
heatmap(data.Properties.VariableNames, data.Properties.VariableNames, corrMatrix);
title('Heatmap of Correlation Matrix');
colorbar;
附件一反应机理
DFA_CS = [0, 10, 20, 30, 40, 50, 60, 80, 100]; % DFA/CS比值
TarYield = [19.46, 17.25, 15.43, 14.14, 13.89, 13.21, 12.84, 12.57, 12.13]; % 焦油收率
% 线性拟合
fit_lin = polyfit(DFA_CS, TarYield, 1);
lin_y = polyval(fit_lin, DFA_CS);
% 绘制拟合线和数据点
figure;
plot(DFA_CS, TarYield, 'o'); % 数据点
hold on;
plot(DFA_CS, lin_y, '-'); % 拟合线
title('Linear Fit of Tar Yield vs DFA/CS');
xlabel('DFA/CS');
ylabel('Tar Yield');
legend('Data Points', 'Linear Fit');
hold off;
% 将拟合系数转换为符号多项式并显示
syms x
lin_poly = poly2sym(fit_lin, x);
fprintf('Linear fit equation: y = %s\n', char(lin_poly));
% 多项式拟合,选择合适的多项式阶数,例如2阶或3阶
fit_poly = polyfit(DFA_CS, TarYield, 2); % 以2阶多项式为例
poly_y = polyval(fit_poly, DFA_CS);
% 绘制拟合曲线和数据点
figure;
plot(DFA_CS, TarYield, 'o'); % 数据点
hold on;
plot(DFA_CS, poly_y, '-'); % 拟合曲线
title('Polynomial Fit of Tar Yield vs DFA/CS');
xlabel('DFA/CS');
ylabel('Tar Yield');
legend('Data Points', 'Polynomial Fit');
hold off;
% 将拟合系数转换为符号多项式并显示
poly_poly = poly2sym(fit_poly, x);
fprintf('Polynomial fit equation: y = %s\n', char(poly_poly));
附件二折线图
% 给定的数据
DFA_CS = [0, 20, 40, 50, 80, 100];
H2 = [6.48, 12.94, 22.65, 30.35, 37.93, 43.62];
CO = [25.93, 21.61, 20.53, 20.95, 22, 23.32];
CO2 = [60.4, 57.84, 52.31, 51.92, 51.53, 50.91];
CH4 = [23.41, 28.79, 33.11, 32.45, 30.83, 30.21];
C2H6 = [2.09, 2.73, 3.08, 2.99, 2.96, 2.94];
C3H8 = [0.55, 0.61, 0.62, 0.71, 0.88, 0.87];
C3H6 = [0.35, 0.37, 0.41, 0.39, 0.37, 0.38];
C2H4 = [0.71, 0.74, 0.81, 0.79, 0.77, 0.75];
C4H10 = [0.32, 0.48, 0.56, 0.37, 0.28, 0.25];
% 创建新的图形窗口
figure;
% 绘制H2产率的散点折线图
subplot(3, 2, 1);
plot(DFA_CS, H2, '-o');
title('H2 Yield vs DFA/CS Ratio');
xlabel('DFA/CS Ratio');
ylabel('H2 Yield (%)');
% 绘制CO产率的散点折线图
subplot(3, 2, 2);
plot(DFA_CS, CO, '-o');
title('CO Yield vs DFA/CS Ratio');
xlabel('DFA/CS Ratio');
ylabel('CO Yield (%)');
% 绘制CO2产率的散点折线图
subplot(3, 2, 3);
plot(DFA_CS, CO2, '-o');
title('CO2 Yield vs DFA/CS Ratio');
xlabel('DFA/CS Ratio');
ylabel('CO2 Yield (%)');
% 绘制CH4产率的散点折线图
subplot(3, 2, 4);
plot(DFA_CS, CH4, '-o');
title('CH4 Yield vs DFA/CS Ratio');
xlabel('DFA/CS Ratio');
ylabel('CH4 Yield (%)');
% 继续绘制C2H6, C3H8, C3H6, C2H4, C4H10产率的散点折线图
subplot(3, 2, 5);
plot(DFA_CS, C2H6, '-o');
title('C2H6 Yield vs DFA/CS Ratio');
xlabel('DFA/CS Ratio');
ylabel('C2H6 Yield (%)');
subplot(3, 2, 6);
plot(DFA_CS, C3H8, '-o');
title('C3H8 Yield vs DFA/CS Ratio');
xlabel('DFA/CS Ratio');
ylabel('C3H8 Yield (%)');
% 如果有更多数据,可以继续添加subplot来绘制
% 调整子图间距
set(gcf, 'Position', [100, 100, 1024, 768]); % 设置图形大小
tight_layout();
% 保存图形
saveas(gcf, 'Pyrolysis_Gas_Yields_vs_DFACS.png');