首先定义变量num为1,循环50次:for i=1:50 训练BP神经网络,最大训练次数num 调取网络权重 若权重下降: num = num + 1; 更新网络 若权重没有下降: 用权重最小的网络继续循环 end