temp = randperm(size(NIR,1)); % 训练集——50个样本 P_train = NIR(temp(1:50),:)’; T_train = octane(temp(1:50),:)’; % 测试集——10个样本 P_test = NIR(temp(51:end),:)’; T_test = octane(temp(51:end),:)’; N = size(P_test,2); %% III. RBF神经网络创建及仿真测...
P_train = NIR(temp(1:50),:)';%取temp中的前50个数据作为NIR的序号,产生训练集,每次运行训练集可能都不一样。 P_train和T_train要保证列是一样的,所以需要对矩阵转置,保证都是50列。 size(A,n) 如果在size函数的输入参数中再添加一项n,并用1或2为n赋值,则 size将返回矩阵的行数或列数。其中r=si...
temp=randn(1,1)*Nstd;X1(i)=Y(i)+temp;X2(i)=Y(i)-temp;end% sifting X1xorigin = X1;xend = xorigin;% save the initial data into the first columnfor jj=1:1:xsizemode(jj,1) = xorigin(jj);endnmode = 1;while nmode <= TNM,xstart = xend;iter = 1;while iter<=5, [sp...
%分别定义Uc,i,Pcsubplot (1,3,1),plot(t,Uc);%画出Figurel二维图形窗,1行3列的第1个子图...
while1 recData(i) = read(scom,1,"uint8"); ifrecData(i) =='$' break; end %数字 ifrecData(i)>='0'&& recData(i)<='9' recData(i) = recData(i)-'0'; end ifrecData(i) ==',' %负数 ifrecData(1) =='-' temp =0; ...
1.matlab常用符号名称 符号意义 sqrt( )求平方根 abs( )求绝对值 fix( )四舍五入取整 exp( ),...
NN=[] % 50种钢管的数量 %% 初始化,上面的步骤a) T = 1000; % 迭代1000步 M = 80; % 种群规模 P = []; % 种群 for m=1:M % 初始化种群 temp.A = temp.B = temp.x = temp.y = P(m)=temp; % 上面需要构造一个合适的方法生成初始可行解,实现较麻烦, % 我的大致思路是 end ...
T=400;omega=2*pi/T;y1=sin(omega*t-0*pi/3);y2=sin(omega*t-2*pi/3);y3=sin(omega*t-4*pi/3);temp=y1(find(y1>=y2));cross(1)=temp(1);temp=y2(find(y2<=y3));cross(2)=temp(1);sort(cross);%排序 figure,hold on 第一条 y11n=find(y1<cross(1) );temp=find...
这个命令就是从矩阵i中取出一个n阶行列式,就是到i的第1行到第n行加上第1行到第n列的数据。下面是一个例子:a = rand(4,5)%产生随机数组,每次运行结果不一定相同i = 4;b = a(1:i,1:i)结果为:a = 0.6557 0.6787 0.6555 0.2769 0.6948 0.0357 0.7577 ...
1. Multiply its output delta and input activation toget the gradientof the weight.、 2. Bring the weight inthe opposite directionof the gradient by subtracting a ration of it from the weight. BP神经网络图示 MATLAB实现所需掌握的知识 数据归一化 ...