Home > other >  For help, MATLAB2009a has been an error code
For help, MATLAB2009a has been an error code

Time:11-21

Small white encountered problems in learning matlab, recently, every brother please correct guidance, on the first code!
% code start
clear all;
clc;
Y0=[1556.573902, 1687.994921, 1827.953783, 2019.351614, 2341.844476, 2645.022587, 3129.123434, 3708.61342, 4404.350411, 5096.770018, 6221.441639, 7252.597416, 8351.371774, 9175.220635, 10029.36497, 11024.08753, 11586.61699, 12407.02271, 13799.8134, 15317.59693].
K0=[1688.96, 1645.64, 1619.68, 1616.16, 1696.87, 1765.45, 1862.86, 1946.95, 2054.54, 2181.33, 2403.98, 2767.43, 3168.70, 3597.55, 3962.81, 4378.10, 4937.75, 5370.14, 5546.94, 5686.01].
L0=[2025.06, 2007.22, 2052.48, 2177.93, 2329.73, 2457.29, 2600.11, 2789.04, 3005.94, 3224.33, 3493.76, 3916.50, 4006.46, 4059.86, 4397.80, 4532.67, 4815.32, 5139.09, 5357.07, 5546.47].
Number=20;
K=K0 (1: number);
L=L0 (1: number);
P=[K0 (1: number), L0 (1: number)]; P=P ';
T=Y0 (1: number); T=T ';
PR=minmax (P); The value range of % P
N=size (T, 1); % number of nodes in the output layer
Net=newff (PR, [n] 5, {' tansig 'and' purelin '});
Net. TrainParam. Epochs=5000; % maximum number of training cycles
Net. TrainParam. Goal=0.001; The target of % error
Net. TrainParam. Show=400; % the interval number
Net="train" (.net, P, T, [], [], [], 120);
B1=net. B {1, 1}; % threshold of the hidden layer node
B2=net. B {2, 1}; % threshold of the output layer
W1=net. IW {1, 1}; % the link weight between the input layer and the hidden layer
W2=net. LW {2, 1}; % the link weight of the hidden layer and the output layer
Y=sim (.net, P);
S=number;
B1=net. B {1, 1}; % threshold of the hidden layer node
B1=repmat (b1, 1, s);
B2=net. B {2, 1}; % threshold of the output layer
B2=repmat (b2, 1, s);
Wl=net. IW {1, 1}; % the link weight between the input layer and the hidden layer
W2=net. LW {2, 1}; % the link weight of the hidden layer and the output layer
M=net inputs {1, 1}. The size; % number of input layer nodes
L=net. The layers {1, 1}. The size; % number of hidden layer nodes
N=net. The layers {2, 1}. The size; % number of output layer nodes
H=Wl * P + b1; % input of hidden layer
Fcn1=net. The layers {1}. TransferFcn; % hidden layer of the activation function
Hout=feval (Fcn1, H); % the output of hidden layer
DFcnl=feval (Fcnl, 'deriv');
Fdh=feval (dFcnl, H, Hout); % derivative of the hidden layer activation function with the new one to the input h
Y=W2 * Hout + b2; % the input of the output layer
Fcn2=net. The layers {2}. TransferFcn; % the activation function of the output layer
Yout=feval (Fcn2, Y); % the output of the output layer
DFcn2=fevaI (Fcn2, 'ideriv');
Polyester Fdy such=feval (dFcn2, Y, Yout); % derivative of the output layer activation function with the new one to the input h
Jyh=zeros (n, l, s);
Jhx=zeros (l, m, s);
Jyx=zeros (n, m, s);
For u=1: s
Fd1=diag (Fdh (:, u)); % for u th sample, the derivative of the nonlinear operator with the new one to h
Jhx (:, :, u)=W1 Fd1 *; % for u th sample, X to h Jacobi matrix
Fd2=diag (polyester Fdy such (:, u)); % for u th sample, the derivative of a nonlinear operator with a new one to y
Jyh (:, :, u)=Fd2 * W2; % for u th sample, h to y Jacobi matrix
Jyx (:, :, u)=Jyh (:, :, u) * Jhx (:, :, u); % for u th sample, x to y Jacobi matrix
End
Jyx=zeros (s, m);
For u=1: s
Jyx (u, :)=jyx (1, :, u);
End
Syx=jyx. * (K, L]/[Y, Y]; The Row % u is the elasticity of the output elasticity coefficient to sample u
% code end



//turn to your bosses, should how to solve this problem! Thank you very much!!!!!!
  • Related