数模-预测模型(神经网络)

image

image

image

image

image

注:EXCEL中选取按 Ctrl + Shift + ↑ + → 就可以立刻选区

image

image

image

image

image

image

image

image

image

image

image

image

代码:

load data_Octane.mat
% 尽量使用新版的Matlab
% 在Matlab的菜单栏点击APP,再点击Neural Fitting app.

% 利用训练出来的神经网络模型对数据进行预测
% 例如我们要预测编号为51的样本,其对应的401个吸光度为:new_X(1,:)
% sim(net, new_X(1,:))
% 错误使用 network/sim (line 266)
% Input data sizes do not match net.inputs{1}.size.
% net.inputs{1}.size
 
% 这里要注意,我们要将指标变为列向量,然后再用sim函数预测
sim(net, new_X(1,:)')

% 写一个循环,预测接下来的十个样本的辛烷值
predict_y = zeros(10,1); % 初始化predict_y
for i = 1: 10
    result = sim(net, new_X(i,:)');
    predict_y(i) = result;
end
disp('预测值为:')
disp(predict_y)

image

上述是输出一个变量的例子,也可以输出多个变量

image

posted @ 2022-05-06 11:18  司砚章  阅读(804)  评论(0编辑  收藏  举报